@prostojs/tree
Version:
Print tree
27 lines • 879 B
TypeScript
export declare class ProstoTree<NodeType = unknown> {
private readonly options;
constructor(options?: Partial<TProstoTreeOptions<NodeType>>);
private _render;
render(root: NodeType, opts?: TProstoTreeRenderOptions): string;
print(root: NodeType, opts?: TProstoTreeRenderOptions): string;
}
export interface TProstoTreeOptionsCharacters {
vLine: string;
hLine: string;
end: string;
middle: string;
node: string;
}
export interface TProstoTreeOptions<NodeType = unknown> {
label: string;
children: string;
renderLabel: (node: NodeType, level: number) => string | string[];
branchWidth: number;
chars: Partial<TProstoTreeOptionsCharacters>;
}
export interface TProstoTreeRenderOptions {
level?: number;
childrenLimit?: number;
showLast?: boolean;
}
//# sourceMappingURL=index.d.ts.map