UNPKG

698 BTypeScriptView Raw
1interface OrderBySortConfs<T, C> {
2 field?: string | ((this: C, item: T, index: number, list: T[]) => any) | null;
3 order?: 'order' | 'desc' | null;
4}
5
6export type OrderByFieldConfs<T, C> = null | string | any[][] | OrderBySortConfs<T, C> | (string | OrderBySortConfs<T, C>)[] | ((this: C, item: T, index: number, list: T[]) => any);
7
8/**
9 * 将数组进行排序
10 * @param array 数组
11 * @param fieldConfs 排序规则
12 * @param context 上下文
13 */
14export declare function orderBy<T, C>(array: T[], fieldConfs: OrderByFieldConfs<T, C>, context?: C): T[];
15
16declare module './ctor' {
17 interface XEUtilsMethods {
18 orderBy: typeof orderBy;
19 }
20}
21
22export default orderBy
23
\No newline at end of file