Published by mattfarina about 7 years ago
This release adds new functions, including:
regexMatch
, regexFindAll
, regexFind
, regexReplaceAll
, regexReplaceAllLiteral
, and regexSplit
to work with regular expressionsfloor
, ceil
, and round
math functionstoDate
converts a string to a datenindent
is just like indent
but also prepends a new lineago
returns the time from time.Now
Published by technosophos over 7 years ago
This release adds several new functions:
snakecase
, camelcase
, and shuffle
are three new string functionsfail
allows you to bail out of a template render when conditions are not metPublished by technosophos over 7 years ago
Inspired by the utility library underscore.js, we've added a bunch of new utility functions to Sprig. Many of these are designed to work on dict
and list
types (and for the time being, on tuple
as well).
Highlights:
semver
and semverCompare
were added by popular demand.list
replaces tuple
join
was fixedComplete changes:
Add semver and semverCompare. 23597e5f6ad0e4d590e71314bfd0251a4a3cf849 (Matt Butcher)
Add without and has functions. 1f3c30139e7139a65b5d6b7f31284d401e5e2487 (Matt Butcher)
Add uniq function. a1c06b6a55acfde86a11947008b0393960879665 (Matt Butcher)
Only install glide during 'make setup' if not already installed. 586619b4e928bd3cca0a46dac8ac6f2c003fd66a (Matt Butcher)
Add setup target to makefile 5db91714c3ebb01eabc8ae26b7d584d6a01c1d30 (Matt Butcher)
Clone the generic map instead of acting directly on it. 10f3ff00763f71fc0a79e770031724db83675929 (Matt Butcher)
Refactor into multiple files. 9e5d6d81df8c6208941133daaba1134065a477e8 (Matt Butcher)
Add pick and omit functions. 44e3642c7dc1354ad15c53fbe4374af4878e765c (Matt Butcher)
Add keys function. 427e90187e0902bc04b64167610f2da7ba26e0e1 (Matt Butcher)
Add 'compact' function. 2009c2546db608c737012557c9d3e836468f0423 (Matt Butcher)
Add 'pluck' function df7a54437d02c7efc12aeb9a44227ca1ae76f861 (Matt Butcher)
Add reverse and coalesce functions. 73a59523c1a8202c02786c296731ef5ce1832ddc (Matt Butcher)
Add toString, toStrings, and sortAlpha. df3624ede7d0c68697394da73bf4434bdfce4d3c (Matt Butcher)
Add list, first, last, initial, rest, prepend, and append. 3e101afd8a97715f7e0dbd41c9988ad6fcaa2d19 (Matt Butcher)
Allow 'join' to take other array/slice types. 713da5382fb1da2b725160e68c0735d3cd196be5 (Matt Butcher)
Published by technosophos almost 8 years ago
This release adds two new sets of functions:
base
, dir
, clean
, ext
, and abs
)set
, unset
, hasKey
)Published by technosophos about 8 years ago
This release adds a uuidv4
template function for generating UUIDs inside of a template.
Published by technosophos about 8 years ago
Four new functions from the strings
package have been exposed as template functions. Following established conventions, we've reversed the order of parameters to better suite template usage:
{{"$5.00" | trimPrefix "$"}}
Additionally, new aliases have been added for a few functions that didn't follow the naming conventions. There is now a trimAll
(used in preference to trimall
) and abbrevBoth
(in preference to abbrevboth
).
At the 3.0 release (whenever that happens), trimall
and abbrevboth
will be removed.
Published by technosophos about 8 years ago
This release adds two functions: until
and untilStep
. These functions generate integer slices. They are designed to be used for iteration:
{{range $i, $val := until 5}}{{end}}
In the above, $i
is the index, and $val
is the value. Both will iterate from 0
to 4
.
For more control, you may use untilStep
. The above can be replicated exactly:
{{range $i, $val := until 0 5 1}}{{end}}
untilStep
takes three arguments: untilStep $start $end $step
:
$start
: The starting value$end
: The end value$step
: The increment valueHere's an example that will produce even numbers less than 10:
{{range $i, $val := until 0 10 2}}
{{$val}}
{{end}}
The above will produce
0
2
4
6
8
Published by technosophos over 8 years ago
New functions:
replace " " "-" "Me First"
renders "Me-First"len "foo" | plural "one foo" "many foos"
renders "many foos"Published by technosophos over 8 years ago
Experimenting with some new crypto functions for orchestration tasks, we've added a genPrivateKey function. Thanks to @bacongobbler for the pull request.
Published by technosophos over 8 years ago
This release adds the following:
default
now prints the default value when it does not receive a value down the pipeline. It is much safer now to do {{.Foo | default "bar"}}
.Published by technosophos over 8 years ago
This release adds a number of new functions:
min
complements max
(formerly biggest
)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
input fields)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.
Published by technosophos over 8 years ago
This release features a few improvements.
quote
and squote
functions for quoting strings.b32enc
and b32dec
for Base32 encoding and decoding.add
now takes varargs: {{ add 1 2 3 }}
biggest
now takes varargs: {{ biggest 5 6 4 }}
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.
Published by mattfarina almost 9 years ago