From 62daa98bf30eebdf65d14b9ca801b1f60f2c919a Mon Sep 17 00:00:00 2001 From: AlteredCoder Date: Fri, 22 May 2020 13:55:48 +0200 Subject: [PATCH] add new helpers --- pkg/exprhelpers/exprlib.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/exprhelpers/exprlib.go b/pkg/exprhelpers/exprlib.go index debb8a15d..4f08a34bc 100644 --- a/pkg/exprhelpers/exprlib.go +++ b/pkg/exprhelpers/exprlib.go @@ -2,6 +2,7 @@ package exprhelpers import ( "strconv" + "strings" log "github.com/sirupsen/logrus" ) @@ -15,6 +16,14 @@ func Atof(x string) float64 { return ret } +func StartsWith(s string, pref string) bool { + return strings.HasPrefix(s, pref) +} + +func EndsWith(s string, suff string) bool { + return strings.HasSuffix(s, suff) +} + func GetExprEnv(ctx map[string]interface{}) map[string]interface{} { var ExprLib = map[string]interface{}{"Atof": Atof}