Skip to content

Releases: Masterminds/sprig

min, empty, tuple, dict, more date functions, and better math

29 Mar 04:58
Compare
Choose a tag to compare

This release adds a number of new functions:

  • min complements max (formerly biggest)
  • empty indicates that a value is the empty value for its type
  • tuple creates a tuple inside of a template: {{$t := tuple "a", "b" "c"}}
  • dict creates a dictionary inside of a template {{$d := dict "key1" "val1" "key2" "val2"}}
  • Date formatters have been added for HTML dates (as used in date input fields)
  • Integer math functions can convert from a number of types, including string (via strconv.ParseInt).

Because we switched from int to int64 as the return value for all integer math functions, the library's major version number has been incremented.

New functions, varargs

03 Feb 04:02
Compare
Choose a tag to compare

This release features a few improvements.

  • Added quote and squote functions for quoting strings.
  • Addedb32enc and b32dec for Base32 encoding and decoding.
  • add now takes varargs: {{ add 1 2 3 }}
  • biggest now takes varargs: {{ biggest 5 6 4 }}
  • README is updated

Our tests indicate that making functions variadic seems to be backward compatible, but we're only doing a few this release in case there are some use cases we hadn't thought of.

Release 1.1.0

29 Dec 19:33
Compare
Choose a tag to compare
  • Added #4: Added contains function. strings.Contains, but with the arguments switched to simplify common pipelines.
  • Added Travis-CI testing support