Collections functions
Use these functions to work with arrays, slices, maps, and page collections.
Use these functions to work with arrays, slices, maps, and page collections.
collections.After INDEX COLLECTION ⟼ anySlices an array to the items after the Nth item. Read More »
collections.Append ELEMENT [ELEMENT...] COLLECTION ⟼ anyAppends one or more elements to a slice and returns the resulting slice. Read More »
collections.Apply COLLECTION FUNCTION PARAM... ⟼ []anyReturns a new collection with each element transformed by the given function. Read More »
collections.Complement COLLECTION [COLLECTION...] ⟼ anyReturns the elements of the last collection that are not in any of the others. Read More »
collections.Delimit COLLECTION DELIMITER [LAST] ⟼ stringLoops through any array, slice, or map and returns a string of all the values separated by a delimiter. Read More »
collections.Dictionary [VALUE...] ⟼ map[string]anyReturns a map composed of the given key-value pairs. Read More »
collections.First N COLLECTION ⟼ anyReturns the given collection, limited to the first N elements. Read More »
collections.Group KEY PAGES ⟼ anyGroups the given page collection by the given key. Read More »
collections.In SET VALUE ⟼ boolReports whether the given value is a member of the given set. Read More »
collections.Index COLLECTION KEY... ⟼ anyReturns the object, element, or value associated with the given key or keys. Read More »
collections.Intersect SET1 SET2 ⟼ anyReturns the common elements of two arrays or slices, in the same order as the first array. Read More »
collections.IsSet COLLECTION KEY ⟼ boolReports whether the key exists within the collection. Read More »
collections.KeyVals KEY VALUE... ⟼ types.KeyValuesReturns a KeyVals struct. Read More »
collections.Last N COLLECTION ⟼ anyReturns the given collection, limited to the last N elements. Read More »
collections.Merge MAP MAP... ⟼ anyReturns the result of merging two or more maps. Read More »
collections.NewScratch ⟼ maps.ScratchReturns a locally scoped “scratch pad” to store and manipulate data. Read More »
collections.Querify [VALUE...] ⟼ stringReturns a URL query string composed of the given key-value pairs, encoded and sorted by key. Read More »
collections.Reverse COLLECTION ⟼ anyReverses the order of a collection. Read More »
collections.Seq LAST ⟼ []intReturns a slice of integers. Read More »
collections.Shuffle COLLECTION ⟼ anyReturns a random permutation of a given array or slice. Read More »
collections.Slice [VALUE...] ⟼ anyReturns a slice composed of the given values. Read More »
collections.Sort COLLECTION [KEY] [ORDER] ⟼ anySorts slices, maps, and page collections. Read More »
COLLECTION | collections.SymDiff COLLECTION ⟼ anyReturns the symmetric difference of two collections. Read More »
collections.Union SET1 SET2 ⟼ anyGiven two arrays or slices, returns a new array that contains the elements that belong to either or both arrays/slices. Read More »
collections.Uniq COLLECTION ⟼ anyReturns the given collection, removing duplicate elements. Read More »
collections.Where COLLECTION KEY [OPERATOR] VALUE ⟼ anyReturns the given collection, removing elements that do not satisfy the comparison condition. Read More »