.sortAsc()

Presentation

Sort array ascending.

Usage

Params

callback

An optional argument that can be used to specify the value to sorted.

The callback receives from params the current interaction value.

sortAsc(callback?: (params: T) => any): Array<T>

That can be used to cast the params for the sort.

Example

[3, 1, 2].sortAsc() // [1, 2, 3]
[{ order: 3 }, { order: 1 }, { order: 2 }].sortAsc(a => a.order)
// [{ order: 1 }, { order: 2 }, { order: 3 }]

Last updated