def

func:sort

sort(val, sorter: null)

Sort a list or grid.

If sorting a list, the sorter should be a function that takes two list items and returns -1, 0, or 1 (typicaly done with the <=> operator. If no sorter is passed, then the list is sorted by its natural ordering.

If sorting a grid, the sorter can be a column name or a function. If a function, it should take two rows and return -1, 0, or 1.

Examples:

// sort string list
["bear", "cat", "apple"].sort

// sort string list by string size
["bear", "cat", "apple"].sort((a,b) => a.size <=> b.size)

// sort sites by area
readAll(site).sort((a, b) => a->area <=> b->area)

meta

supertypes

feature

Feature namespace of definitions formatted as feature:name

    func

Axon function