UNPKG

652 BTypeScriptView Raw
1
2export interface FilterTreeOptions {
3 children?: string;
4}
5
6/**
7 * 从树结构中根据回调过滤数据
8 * @param {Object} list 数组
9 * @param {Function} iterate(item, index, items, path, parent) 回调
10 * @param {Object} options {children: 'children'}
11 * @param {Object} context 上下文
12 */
13export 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[];
14
15declare module './ctor' {
16 interface XEUtilsMethods {
17 filterTree: typeof filterTree;
18 }
19}
20
21export default filterTree