filterTree.d.ts 631 B

123456789101112131415161718192021
  1. export interface FilterTreeOptions {
  2. children?: string;
  3. }
  4. /**
  5. * 从树结构中根据回调过滤数据
  6. * @param {Object} list 数组
  7. * @param {Function} iterate(item, index, items, path, parent) 回调
  8. * @param {Object} options {children: 'children'}
  9. * @param {Object} context 上下文
  10. */
  11. export declare function filterTree<T, C>(list: T[], iterate: (this: C, item: T, index: number, items: T[], path: string[], parent: T, nodes: T[]) => boolean, options?: FilterTreeOptions, context?: C): T[];
  12. declare module './ctor' {
  13. interface XEUtilsMethods {
  14. filterTree: typeof filterTree;
  15. }
  16. }
  17. export default filterTree