Skip to content

Bars Specification 0.1.0 — Transform: sort

Category: list · Since: 0.1.0

Sorts a list.

With no argument, sorts the input list's elements themselves; with property, sorts by that property of each element (a struct). Keys must be uniformly numeric or uniformly string, else the result is null.

Input coercion: list

Arguments

Name Type Optional Default
property string yes

Arity: 0–1

Worked examples

{{ xs | sort }}

[1,2,3]
{{ items | sort: "n" }}

[{"n":1},{"n":2},{"n":3}]

Full fixture: transforms/transform-sort.json