
Company News
Socket Has Acquired Secure Annex
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.
tree-to-string
Advanced tools
npm install tree-to-string
const treeToString = require('tree-to-string')
const tree = {
value: [7],
children: [{
value: [3, 5],
children: [{
value: [2]
}, {
value: [4]
}, {
value: [6]
}]
}, {
value: [8]
}]
}
console.log(treeToString(tree))
Running the above prints something similar to
[ 2 ]─┐
│
[ 4 ]─┼─[ 3, 5 ]─┐
│ │
[ 6 ]─┘ ├─[ 7 ]
│
[ 8 ]─┘
const str = treeToString(tree, [format])Converts a tree to a human friendly string. The tree should have a layout similar to this
{
value: someJsObject,
children: [tree, ...]
}
Format defaults to util.inspect. Change this to your
own method that pretty prints your object if your prefer.
MIT
FAQs
Convert a tree structure into a human friendly string
The npm package tree-to-string receives a total of 41 weekly downloads. As such, tree-to-string popularity was classified as not popular.
We found that tree-to-string 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.

Company News
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.

Research
/Security News
Socket is tracking cloned Open VSX extensions tied to GlassWorm, with several updated from benign-looking sleepers into malware delivery vehicles.

Product
Reachability analysis for PHP is now available in experimental, helping teams identify which vulnerabilities are actually exploitable.