Stable sort using provided callback without modifications.
A custom key function can be supplied to customize the sort order.
Key can return any nested data structure, supports number, booleans, arrays, objects.
// Sort by object key sortBy(arr, v=>v.myKey)) // Sort by number in reversed order sortBy(arr, v=>v.numberKey * -1)) // Sort by object key, then by boolean value in revered order sortBy(arr, v=> [v.myKey, !v.boolValue])
Stable sort using provided callback without modifications. A custom key function can be supplied to customize the sort order. Key can return any nested data structure, supports number, booleans, arrays, objects.