Skip to content

Commit c2ae68b

Browse files
v1.10.0
1 parent 1e6bbd7 commit c2ae68b

9 files changed

+158
-46
lines changed

build/arrayToTree.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,10 @@ export interface Config {
1919
* Unflattens an array to a tree with runtime O(n)
2020
*/
2121
export declare function arrayToTree(items: Item[], config?: Partial<Config>): TreeItem[];
22+
/**
23+
* Returns the number of nodes in a tree in a recursive way
24+
* @param tree An array of nodes (tree items), each having a field `childrenField` that contains an array of nodes
25+
* @param childrenField Name of the property that contains the array of child nodes
26+
* @returns Number of nodes in the tree
27+
*/
28+
export declare function countNodes(tree: TreeItem[], childrenField: string): number;

build/arrayToTree.js

+20-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/arrayToTree.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/arrayToTree.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/arrayToTree.spec.js

+66
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/arrayToTree.spec.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "performant-array-to-tree",
3-
"version": "1.9.2",
3+
"version": "1.10.0",
44
"description": "Converts an array of items with ids and parent ids to a nested tree in a performant `O(n)` way. Runs in browsers and node.",
55
"keywords": [
66
"array to tree",

0 commit comments

Comments
 (0)