Transform
Sort, map, merge, and fold collections.
Transform
flattenFlattens a slice by exactly one level: any element that is itself a
slice or array is spread into the result, and every other element is copied
through unchanged.{{ groups | flatten }}mapConverts a slice of string-keyed maps into a single map keyed by the named
field's value, turning a list you have to scan into a lookup table.{{ users | map:'id' }}mergeKeys a slice of maps by the named field, producing a lookup map.{{ users | merge:'id' }}sortSorts a copy of a slice in the named direction, 'asc' or 'desc'; any
other direction is an error.{{ scores | sort:'desc' }}sumTotals the named field across a slice of maps, the way you sum one
column of a list of records.{{ items | sum:'price' }}