collection.sort()
Stably sorts iterated values.
Signature
collection.sort(iterable[, comparator])
Parameters
Iterable and optional function comparator(left, right) returning an ordered negative, zero or positive number. Default uses numeric or text ordering.
Returns
New array.
Behavior
Preserves the order of ties. Sorts a materialized copy of the entries.
Errors
Incomparable values, invalid comparator result or callback error.
Example
use collection
assert(collection.sort([3, 1, 2])[0] == 1)