
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
simplicitree
Advanced tools

This Tree object is a tree of nodes where each node is a key-value pair and the original insertion order is remembered. Keys can be bigints, booleans, numbers, objects, strings, or symbols, or arrays of those primitives. Values cannot be undefined.
A common practice when using relational databases is to keep parent-child relationships in a join table or as self referential 'parent' keys in the data table itself. Complex code or queries must be created to recurse through those relationships. This activity can become highly repetitive over time because column names and data varies from table to table, and apis based on that data may be inconsistent.
The Tree provides well known collection methods for recursive iteration as well as standard methods for data insertion, retrieval, and deletion by formally seperating node relationships from the data itself. It can be used as a standalone utility to efficiently generate nested tuples. Access times that are sublinear on the number of elements in the collection can be expected, e.g. better than O(N).
Typescript typings are provided.
Terminology:
Trees with single or multiple Root nodes are supported. Keys must be unique; duplicate primitives can be made unique using an array representing the path to the node. As nodes are added to the Tree, references to datum objects are preserved and returned.
$ npm install simplicitree
import { Tree } from "simplicitree";
// Create a tree
const t = new Tree();
properties:
.defaultDatum
.depth
.hasDescendents
.isEmpty
.roots
.size
methods:
.ancestorOf(path)
.cascade(callbackfn, path, inclusive?)
.clear()
.delete(path)
.entries()
.entriesOf(path?, depth?)
.everyOf(callbackfn, path?, depth?)
.firstDescendentsOf(path)
.forEach(callbackfn)
.get(path)
.getNode(path)
.has(path)
.keys()
.keysOf(path?, depth?)
.prune(path)
.reduceOf(callbackfn, initialValue, path?, inclusive?)
.set(path, datum?)
.setNode(path, datum?, ancestor?)
.someOf(callbackfn, path?, depth?)
.toNestedValuesOf(path?)
.traverse(callbackfn, path, order?)
.values()
.valuesOf(path?, depth?)
method arguments definitions:
path: a primitive, or a unique array of primitives, which identify a single node
inclusive: a boolean representing how callbacks with path arguments are processed
- when true, the node related to the path argument is provided to the callback function
- when false, the node is not provided to the callback function
- ignored when a method's path argument is optional and the path argument is not provided
depth: a non-negative integer describing how descendents are provided to callback functions
- methods which offer a depth argument are always inclusive
- when a path argument is optional and the path argument is not provided, a depth of zero refers to Root nodes
- when a path argument is provided, a depth of zero refers to the node related to the path
FAQs
a simple Tree object
We found that simplicitree demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.