Releases: Masterminds/sprig
Releases · Masterminds/sprig
min, empty, tuple, dict, more date functions, and better math
This release adds a number of new functions:
min
complementsmax
(formerlybiggest
)empty
indicates that a value is the empty value for its typetuple
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
(viastrconv.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
This release features a few improvements.
- Added
quote
andsquote
functions for quoting strings. - Added
b32enc
andb32dec
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
- Added #4: Added contains function. strings.Contains, but with the arguments switched to simplify common pipelines.
- Added Travis-CI testing support