Docs
OverviewTemplate SyntaxQuick Guide

Resources

Source code

Modifiers

Text
Casing
lowerslugtitletitle_modelupper
Edit
concatreplacereplace_patternreverseshortenwrap
Split & join
joinlinessplit
Trim
trimtrim_prefixtrim_suffix
Escape
escape_htmlescape_jsescape_url
Format
currencydecimalformatlengthline_numbers
Collections
Access
findfirstkeylastpluck
Query
filterhasis
Transform
flattenmapmergesortsum
Files & paths
File
file
Path
dirnameextext_dotext_prependext_trimfilename
Convert
Parse
from_csvfrom_jsonfrom_yaml
Serialize
jsonmarkdownyaml
Logic
Compare
eqgtgtenot
Default
default
Render
Template
template
Docs/Sintax/Collections/Transform

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' }}
Edit or read the source on GitHub
PreviousisNext flatten

Built with in Vilnius, Lithuania Say hello!

ProductsOpen sourceDocs GitHub