DieselDepot-APP/node_modules/es-toolkit/dist/fp/array/orderBy.d.ts
SJCoetz def597c157 chore: add generated build artifacts and node module type files
add all Next.js build outputs and third-party dependency type declaration files
2026-07-20 01:18:42 +02:00

21 lines
No EOL
953 B
TypeScript

//#region src/fp/array/orderBy.d.ts
/**
* Creates a function that sorts objects by criteria and order directions.
*
* Criteria can be object keys or selector functions. The returned function does not mutate
* the input array; it returns a sorted copy following the main {@link orderBy} behavior.
*
* @template T - The object type in the array.
* @param criteria - Keys or selector functions used for comparison.
* @param orders - Sort directions corresponding to the criteria.
* @returns A function that maps a readonly array to a sorted copy.
*
* @example
* import { orderBy, pipe } from 'es-toolkit/fp';
*
* pipe([{ name: 'a', age: 2 }, { name: 'b', age: 1 }], orderBy(['age'], ['asc']));
* // => [{ name: 'b', age: 1 }, { name: 'a', age: 2 }]
*/
declare function orderBy<T extends object>(criteria: Array<((item: T) => unknown) | keyof T>, orders: Array<'asc' | 'desc'>): (array: readonly T[]) => T[];
//#endregion
export { orderBy };