Skip to content

Commit

Permalink
Merge pull request #123 from sandro768/master
Browse files Browse the repository at this point in the history
adds isBranch property to flattenTree function
  • Loading branch information
dgreene1 authored Sep 13, 2023
2 parents 75ec30b + b3d2ee7 commit e2751be
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/TreeView/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ export type IFlatMetadata = Record<string, string | number | undefined | null>;
interface ITreeNode<M extends IFlatMetadata> {
id?: NodeId;
name: string;
isBranch?: boolean;
children?: ITreeNode<M>[];
metadata?: M;
}
Expand All @@ -310,6 +311,7 @@ export const flattenTree = <M extends IFlatMetadata>(
id: tree.id || internalCount,
name: tree.name,
children: [],
...(tree.isBranch && { isBranch: tree.isBranch }),
parent,
metadata: tree.metadata ? { ...tree.metadata } : undefined,
};
Expand Down

0 comments on commit e2751be

Please sign in to comment.