
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
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 159 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.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.