UNPKG

typedash

Version:

modern, type-safe collection of utility functions

28 lines (27 loc) 1.23 kB
import { t as KeysOfUnion } from "./KeysOfUnion-CRGM1li-.js"; import { t as Many } from "./Many-CC3hL8UU.js"; import { t as Maybe } from "./Maybe-pvX1mStM.js"; import { Primitive } from "type-fest"; //#region src/functions/orderBy/orderBy.d.ts /** * Sorts an array of objects by one or more properties, in ascending or descending order. * @param array The array of objects to sort. * @param iterators The property or properties to sort by. Can be a key of `TValue` or a function that returns a comparable value. * @param orders The order or orders to sort by. Can be "asc" or "desc". Defaults to "asc". * @returns A new array of objects sorted by the specified properties and orders. */ declare function orderBy<TValue>(array: Maybe<readonly TValue[]>, iterators: Many<OrderByIterator<TValue>>, orders?: Many<Order>): TValue[]; type Order = 'asc' | 'desc'; type OrderByIterator<TValue> = ((value: TValue) => ComparableValue) | KeysOfUnion<TValue>; type ComparableValue = Exclude<Primitive, symbol> | { [Symbol.toPrimitive](): Primitive; } | { valueOf(): Primitive; } | { toString(): string; } | { [Symbol.toStringTag]: string; }; //#endregion export { orderBy as t }; //# sourceMappingURL=orderBy-Iboua8EK.d.ts.map