fast-sort-lens
Version:
API wrapper around fast-sort
14 lines (13 loc) • 521 B
TypeScript
import { sort } from "fast-sort";
//#region src/index.d.ts
type FastSortRule<T> = {
prop: keyof T | ((it: T) => any);
order: 'asc' | 'desc' | ((a: any, b: any) => number);
};
/**
* just like _.orderBy API spec, (_: lodash / es-toolkit)
*/
declare function fastOrderBy<T>(list: T[], props: FastSortRule<T>['prop'][], orders: FastSortRule<T>['order'][]): T[];
declare function fastSortWithRules<T>(list: T[], rules: FastSortRule<T>[]): T[];
//#endregion
export { FastSortRule, fastOrderBy, fastSortWithRules, sort };