@ark-ui/react
Version:
A collection of unstyled, accessible UI components for React, utilizing state machines for seamless interaction.
16 lines (14 loc) • 346 B
JavaScript
'use client';
function getBranchValues(tree, depth) {
let values = [];
tree.visit({
onEnter: (node, indexPath) => {
if (indexPath.length === 0) return;
if (tree.isBranchNode(node) && indexPath.length <= depth) {
values.push(tree.getNodeValue(node));
}
}
});
return values;
}
export { getBranchValues };