diff --git a/README.md b/README.md index b72398c..fcead74 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,7 @@ There are a few built in functions as well: * `upper $value` - Uppercase a string. * `jsonQuery $json $query` - Returns the result of a selection query against a json document. * `loop` - Create for loops. + * `isStrFullMatch` - Returns true if a string is match another string ### jsonQuery diff --git a/template.go b/template.go index a42d15c..d5d49d3 100644 --- a/template.go +++ b/template.go @@ -115,21 +115,29 @@ func loop(args ...int) (<-chan int, error) { return c, nil } +func isStrFullMatch(src, dst string) bool { + if src == dst { + return true + } + return false +} + func generateFile(templatePath, destPath string) bool { tmpl := template.New(filepath.Base(templatePath)).Funcs(template.FuncMap{ - "contains": contains, - "exists": exists, - "split": strings.Split, - "replace": strings.Replace, - "default": defaultValue, - "parseUrl": parseUrl, - "atoi": strconv.Atoi, - "add": add, - "isTrue": isTrue, - "lower": strings.ToLower, - "upper": strings.ToUpper, - "jsonQuery": jsonQuery, - "loop": loop, + "contains": contains, + "exists": exists, + "split": strings.Split, + "replace": strings.Replace, + "default": defaultValue, + "parseUrl": parseUrl, + "atoi": strconv.Atoi, + "add": add, + "isTrue": isTrue, + "lower": strings.ToLower, + "upper": strings.ToUpper, + "jsonQuery": jsonQuery, + "loop": loop, + "isStrFullMatch": isStrFullMatch, }) if len(delims) > 0 {