Helper functions in template strings

Hello all. I’d like to ask for some feedback. I just posted this PR, which adds helper functions to our templating syntax: feat(template): add template helper functions by edvald · Pull Request #2320 · garden-io/garden · GitHub

Here are some examples from the added docs:

  • ${base64Decode("bXkgdmFsdWU=")}"my value"
  • ${base64Encode("my value")}"bXkgdmFsdWU="
  • ${jsonDecode("{\"foo\": \"bar\"}")}{"foo":"bar"}
  • ${jsonEncode(["some","array"])}"[\"some\",\"array\"]"
  • ${lower("Some String")}"some string"
  • ${replace("string_with_underscores", "_", "-")}"string-with-underscores"
  • ${split("a,b,c", ",")}["a","b","c"]
  • ${trim(" some string with surrounding whitespace ")}"some string with surrounding whitespace"
  • ${upper("Some String")}"SOME STRING"

I created this grab bag of functions that I remembered someone asking about or had in my notes, but I’m quite sure there are others on your wishlists :slight_smile:

So, please fire away with any suggestions for more functions and I’ll happily add them to the mix. It’ll be super easy to add these helpers now and going forward, so anything goes!