Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
key-tree-store
Advanced tools
Simple tool for storing/retrieving objects events based hierarchical keypaths.
Simple tool for storing/retrieving objects events based hierarchical keypaths.
It lets you store and retrive objects that are at an equal or deeper key path than what you give it.
npm install key-tree-store
Assume you've got a structure like this:
{
'first': [ {obj: 1}, {obj: 2} ],
'first.stuff': [ {obj: 3} ],
'first.something.other': [ {obj: 4}, {obj: 5} ]
}
Then you can retrive it by key. Where it returns anything at or deeper than level supplied.
var KeyTree = require('key-tree-store');
var tree = new KeyTree();
tree.add('first', {id: 'one'});
tree.add('first.second', {id: 'two'});
tree.add('first.second', {id: 'three'});
tree.add('first.second.third', {id: 'four'});
// now we can retrieve them by key
tree.get('first'); // returns all of them
tree.get('first.second'); // returns array of objects two, three and four
tree.get('first.second.third'); // returns array of object four;
// that's all there is to it
removing items:
var KeyTree = require('key-tree-store');
var tree = new KeyTree();
var obj1 = {obj: '1'};
tree.add('key.path', obj1);
// removes it no matter what key
tree.remove(obj1);
If you like this follow @HenrikJoreteg on twitter.
MIT
FAQs
Simple tool for storing/retrieving objects events based hierarchical keypaths.
The npm package key-tree-store receives a total of 20,886 weekly downloads. As such, key-tree-store popularity was classified as popular.
We found that key-tree-store demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.