/** * 将树形结构数组扁平化为一维数组的策略 */ export declare const FlattenTreeStrategyConst: { readonly DFS: "DFS"; readonly BFS: "BFS"; }; /** * 将树形结构数组扁平化为一维数组的策略的类型 */ export type FlattenTreeStrategyConstType = (typeof FlattenTreeStrategyConst)[keyof typeof FlattenTreeStrategyConst]; /** * 将树形结构数组扁平化为一维数组的方法的配置选项参数类型 */ export type FlattenTreeOptionsType = { childrenFieldName?: string; isRemoveChildrenField?: boolean; strategy?: FlattenTreeStrategyConstType; }; /** * 将树形结构数组扁平化为一维数组 * * @param {Array>} arr 树形结构数组 * @param {FlattenTreeOptionsType} options 将树形结构数组扁平化为一维数组的配置选项: * - childrenFieldName:树形结构数组中父节点中存放子节点的字段名,默认为 'children' * - isRemoveChildrenField:在将树形结构数组扁平化为一维数组的过程中,是否移除树形结构数组中 * 父节点中存放子节点的字段,默认为 true * - strategy:扁平化数组过程中对树形结构数组的遍历策略,默认为 'DFS',可选值有 'DFS' 和 'BFS' * @returns {Array>} 扁平化后的一维数组 */ export declare const flattenTree: (arr: Array>, options?: FlattenTreeOptionsType) => Array>; export type FlattenTreeType = typeof flattenTree;