Skip to content

Commit

Permalink
type: Add Tree2ArrayOptions interface and related functions to helper…
Browse files Browse the repository at this point in the history
… namespace
  • Loading branch information
AxiosLeo committed Feb 23, 2024
1 parent 4f657c7 commit da23964
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions index.d.ts
Expand Up @@ -711,6 +711,31 @@ export namespace helper {
function empty(a: any): boolean
}

export interface Tree2ArrayOptions {
/**
* The name of the parent node index
* @default 'parent_id'
*/
parent_index?: string;

/**
* The name of the data index
* @default 'id'
*/
data_index?: string;

/**
* The name of the child node index
* @default 'child'
*/
child_name?: string;
}

interface BaseObject {
id: string,
name: string,
}

module obj {
function _flatten(obj: ObjectItem, sep: string): ObjectItem;
function _flatten<T>(obj: T, sep: string): ObjectItem;
Expand All @@ -720,6 +745,8 @@ export namespace helper {
function _assign<T>(targetObj: T, ...objs: ObjectItem[]): T;
function _deep_clone(obj: ObjectItem): ObjectItem;
function _deep_clone<T>(obj: T): T;
function _tree2array(tree: any[] | any, options?: Tree2ArrayOptions);
function _array2tree(array: any[], options?: Tree2ArrayOptions);
}

export interface EmitterConfig {
Expand Down

0 comments on commit da23964

Please sign in to comment.