orderBy.d.ts 676 B

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