orderBy (Functional Programming) es-toolkit
Creates a function that sorts objects by criteria and sort orders. Use it with pipe.
Info
Usage
orderBy sorts the piped array by each criterion in order. Each order controls whether the matching criterion is sorted ascending or descending.
Parameters
criteriaArray<((item: T) => unknown) | keyof T>required
The object keys and/or selector functions used for comparison.
ordersArray<'asc' | 'desc'>required
The sort order for each criterion.
Returns
A function that maps a readonly T[] to a new, sorted array.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.