Element type produced by the source iterable.
Key type produced by the selector.
An OrderedIterable representing the ascending order and supporting chained thenBy calls.
const words = ["pear", "banana", "fig", "apple"];
const byLength = [..._orderBy(words, (word) => word.length)];
console.log(byLength); // ["fig", "pear", "apple", "banana"]
or using the curried version:
const byLength = [
...pipeInto(
["pear", "banana", "fig", "apple"],
orderBy((word) => word.length)
),
];
console.log(byLength); // ["fig", "pear", "apple", "banana"]
Sorts the source iterable in ascending order based on a key selector.