typedash
Version:
modern, type-safe collection of utility functions
28 lines (27 loc) • 1.23 kB
text/typescript
import { t as KeysOfUnion } from "./KeysOfUnion-D3-apcAx.cjs";
import { t as Many } from "./Many-bCNxekD7.cjs";
import { t as Maybe } from "./Maybe-BVpZiDsE.cjs";
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-B992KkBi.d.cts.map