![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
tree-manipulator
Advanced tools
A service manipulating tree object.
npm install tree-manipulator --save
var tree = {
id: '1',
children: [{
id: '2',
children: [
{
id: '3',
},
{
id: '4'
}
]
}, {
id: '5',
children: [{
id: '6'
}, {
id: '7'
}]
}]
};
var tm = new TreeManipulator();
tm.findNode('2', tree);
//
/*
Returns the entire node with identifier '2' and its path
{
node: {id:'2' ... },
path: ['1', '2']
}
*/
tm.deleteNode('2', tree);
/*
Deletes node from the tree. Returns the entire node with identifier '2' and its path.
returns {
node: {id:'2' ... },
path: ['1', '2']
}
*/
tm.createNode('8', {parent: '2', before: '4'}, tree);
/*
Inserts a new node before the node '4'. Returns a new node with identifier '8' and its path.
returns {
node: {id:'8' ... },
path: ['1', '2', '8']
}
*/
tm.createNode('8', {parent: '2', after: '3'}, tree);
/*
Inserts a new node after the node '3'. Returns a new node with identifier '8' and its path.
returns {
node: {id:'8' ... },
path: ['1', '2', '8']
}
*/
tm.createNode('8', {parent: '2'}, tree);
/*
Appends a new node as a last child of the node '2'. Returns a new node with identifier '8' and its path.
returns {
node: {id:'8' ... },
path: ['1', '2', '8']
}
*/
tm.print(tree);
/**
output:
1
\___5
\___6
\___7
**/
#####constructor (options)
Object
]
String
]'id'
String
]'children'
Function
]function(){
//returns a unique sha derived from timestamp and an internal counter
}
Function
]function(obj, property) {
return obj[property];
}
Function
]function(obj, property, value) {
obj[property] = value;
}
Function
]function() {
return {};
}
Function
]function(item, index, array) {
array.splice(index, 0, item);
}
Function
]function(item, array) {
var index = array.indexOf(item);
return array.splice(index, 1)[0];
}
#####findNode (identifierValue, tree)
String
]Object
]Object
]
Object
]Array
]#####createNode (identifierValue, options, tree)
String
]Object
]
String
] - parent identifierString
] - before identifierString
] - after identifierObject
]Object
]
Object
]Array
]#####deleteNode (identifierValue, tree)
String
]Object
]Object
]
Object
]Array
]#####print (tree)
Object
]FAQs
Tree object manipulator
The npm package tree-manipulator receives a total of 4 weekly downloads. As such, tree-manipulator popularity was classified as not popular.
We found that tree-manipulator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.