Sorts the elements of a sequence in ascending order.
The source iterable.
A function to extract the key for each element.
An IOrderedEnumerable whose elements are sorted according to a key.
const items = [{ id: 1 }, { id: 3 }, { id: 2 }];const ordered = orderBy(items, x => x.id).toArray(); // Will be [{ id: 1 }, { id: 2 }, { id: 3 }] Copy
const items = [{ id: 1 }, { id: 3 }, { id: 2 }];const ordered = orderBy(items, x => x.id).toArray(); // Will be [{ id: 1 }, { id: 2 }, { id: 3 }]
TSource The type of the source iterable.
TKey The type of the key returned by keySelector.
An Comparer to compare keys.
Sorts the elements of a sequence in ascending order.