![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
tree-node-data
Advanced tools
Assigns a set of structure meta data for each node in your tree structure useful for tree data display and data traversal
tree-node-data
assigns a set of structure meta data for each node in your tree data structure.
Meta data includes parent, prev, prevSibling, next, nextSibling, siblingIndex, ancestors, numDescendants, numChildren.
It is useful for building tree structure UI for data display and data traversal.
npm install tree-node-data
nodeData
field; Original tree node data is intact.In short, it provides a function that assigns an extra field named nodeData
to each node of your tree.
Origin | Result |
---|---|
|
|
Field | Description |
---|---|
parent | key value of parent node |
prevSibling | key value of previous sibling node. null if the current node has no previous sibling node. i.e. it is the first/only child of its parent. |
nextSibling | key value of next sibling node. null if the current node has no next sibling node. i.e. it is the last/only child of its parent. |
prev | key value of previous node. Previous node is defined as previous sibling if found or parent node. |
next | key value of next node. Next node is defined as next sibling node if found. Otherwise, it will be the 'nextSibling' of the closest ancestor that has a 'nextSibling'; |
siblingIndex | The integer index of the current node amongst its siblings. Index starts from 0. |
ancestors | Array of key values of all ancestor nodes. This is useful for working out branch collapsed/expanded status. |
numDescendants | This is the number of leaf nodes. This is useful for showing all items under a branch node. |
numChildren | number of direct child nodes. |
import assignNodeData from 'tree-node-data';
const config = {
childrenField: 'children', // e.g. customise the field for children nodes. e.g. 'subItems', default 'children'
keyField: 'key', // e.g. customise the field for node key. e.g. 'id', default 'key'
};
const nodesWithData = assignNodeData(
nodes, // array of tree nodes.
config,
)
assignNodeData
;tree-node-util
and tree-node-data
together provides the powerful tools for building complex tree data structure UIs;FAQs
Assigns a set of structure meta data for each node in your tree structure useful for tree data display and data traversal
The npm package tree-node-data receives a total of 0 weekly downloads. As such, tree-node-data popularity was classified as not popular.
We found that tree-node-data demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.