Creates sort callback which can be used for array.sort input.
A custom key function can be supplied to customize the sort order.
Key can return any nested data structure, supports number, booleans, arrays.
// Sort by object key arr.sort(sortByCb(v=>v.myKey)) // Sort by number in reversed order arr.sort(sortByCb(v=>v.numberKey * -1)) // Sort by object key, then by boolean value in revered order arr.sort(sortByCb(v=> [v.myKey, !v.boolValue])
Creates sort callback which can be used for
array.sort
input. A custom key function can be supplied to customize the sort order. Key can return any nested data structure, supports number, booleans, arrays.