
Security News
Insecure Agents Podcast: Certified Patches, Supply Chain Security, and AI Agents
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.
Data oriented tree structure that unleashes the power of callbacks to create, search and traverse the tree.
Data oriented tree structure that unleashes the power of callbacks to create, search and traverse tree. Data tree keeps the track of current node which updates upon insertion and deletion of the node from tree.
$ npm install data-tree
Then use via require('data-tree') OR use browserified build available at dataTree.min.js in <script/> directly.
Following examples will guide you to create tree, insert/remove nodes and search/traverse a tree. Don't forget to checkout Data-Tree reference.
dataTree is global variable that can be used to create a tree in following way.
var tree = dataTree.create();
// Insert single value
tree.insert(183);
// Insert array of values
// NOTE: This does not create 3 different nodes. It considers an array as a whole data and puts in a single node.
tree.insert([34, 565, 78]);
// Insert Objects
tree.insert({
key: '#berries',
value: { name: 'Apple', color: 'Red'}
});
// Insert data
tree.insert({
key: '#apple',
value: { name: 'Apple', color: 'Red'}
});
// New Data
var greenApple = {
key: '#greenapple',
value: { name: 'Green Apple', color: 'Green' }
};
// Insert data to node which has `key` = #apple
tree.insertTo(function(data){
return data.key === '#apple'
}, greenApple);
// Insert data
var node = tree.insert({
key: '#apple',
value: { name: 'Apple', color: 'Red'}
});
// New Data
var greenApple = {
key: '#greenapple',
value: { name: 'Green Apple', color: 'Green' }
};
// Insert data to node
// This will create a new node with given data and append to parent node provided
tree.insertToNode(node, greenApple);
// Insert Node
var node = tree.insert({
key: '#apple',
value: { name: 'Apple', color: 'Red'}
});
// Remove it
tree.remove(node);
var node = tree.traverser().searchBFS(function(data){
return data.key === '#apple';
});
var node = tree.traverser().searchDFS(function(data){
return data.key === '#apple';
});
tree.traverser().traverseBFS(function(node){
console.log(node.data());
});
tree.traverser().traverseDFS(function(node){
console.log(node.data());
});
var commonParent = tree.findCommonParent(fromNode, toNode);
cd into itnpm installnpm run build to build browserify files OR npm run dev-server to start a development server.FAQs
Data oriented tree structure that unleashes the power of callbacks to create, search and traverse the tree.
The npm package data-tree receives a total of 15 weekly downloads. As such, data-tree popularity was classified as not popular.
We found that data-tree 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
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.

Security News
The planned feature introduces a review step before releases go live, following the Shai-Hulud attacks and a rocky migration off classic tokens that disrupted maintainer workflows.