Documentation ¶
Index ¶
- func Chunk(items []any, size int) [][]any
- func Filter(items []any, pred func(any) bool) []any
- func FuncMap() template.FuncMap
- func Group(items []any, keyFn func(any) any) map[any][]any
- func Has(s []any, item any) bool
- func New(items ...any) []any
- func Reverse(items []any) []any
- func Sort(items []any) []any
- func Unique(items []any) []any
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Chunk ¶
Chunk splits a slice into chunks of the specified size
Example: {{ slice.chunk .Slice 3 }} -> [[1 2 3] [4 5 6] [7 8 9]]
func Filter ¶
Filter returns a new slice containing only the elements that satisfy the predicate
Example: {{ slice.filter .Slice (lambda (x) (gt x 5)) }} -> [6 7 8 9]
func Group ¶
Group groups slice elements by a key function
Example: {{ slice.group .Items (index . "key") }} -> map[key:[item1 item2] key2:[item3 item4]]
func Reverse ¶
Reverse reverses the elements in a slice
Example: {{ slice.reverse .Slice }} -> [5 4 3 2 1]
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.