徐总多门店
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

29 lines
801 B

export interface FindTerrResult<T = any> {
index: number;
item: T;
path: Array<string>;
items: T[];
parent: T;
nodes: T[];
}
export interface FindTreeOptions {
children?: string;
}
/**
* 从树结构中查找匹配第一条数据的键、值、路径
* @param {Object} list 数组
* @param {Function} iterate(item, index, items, path, parent, nodes) 回调
* @param {Object} options {children: 'children'}
* @param {Object} context 上下文
*/
export declare function findTree<T, C>(list: T[], iterate: (this: C, item: T, index: number, items: T[], path: string[], parent: T, nodes: T[]) => boolean, options?: FindTreeOptions, context?: C): FindTerrResult<T>;
declare module './ctor' {
interface XEUtilsMethods {
findTree: typeof findTree;
}
}
export default findTree