mapTree.d.ts 1.1 KB

1234567891011121314151617181920212223
  1. interface MapTreeOptions {
  2. children?: string;
  3. mapChildren?: string;
  4. }
  5. /**
  6. * 从树结构中指定方法后的返回值组成的新数组
  7. * @param {Object} obj 对象/数组
  8. * @param {Function} iterate(item, index, items, path, parent, nodes) 回调
  9. * @param {Object} options {children: 'children', mapChildren: 'children}
  10. * @param {Object} context 上下文
  11. */
  12. export declare function mapTree<T, U, C>(array: T[], iterate: (this: C, item: T, index: number, items: T[], path: string[], parent: T, nodes: T[]) => U, options?: MapTreeOptions, context?: C): U[];
  13. export declare function mapTree<U, C>(array: any[], iterate: (this: C, item: any, index: number, items: any[], path: string[], parent: any, nodes: any[]) => U, options?: MapTreeOptions, context?: C): U[];
  14. export declare function mapTree<U, C>(array: any, iterate: (this: C, item: any, index: number, items: any, path: string[], parent: any, nodes: any) => U, options?: MapTreeOptions, context?: C): U[];
  15. declare module './ctor' {
  16. interface XEUtilsMethods {
  17. mapTree: typeof mapTree;
  18. }
  19. }
  20. export default mapTree