
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
A tree diagram (SVG) generator. A modernized version of treefun, a tree builder that was delivered as a static JS file. This new version can be installed with NPM, is written in ES6 and has Typescript support.
Online demo https://treefun.appspot.com/
NPM package https://www.npmjs.com/package/treefun2
Blog article https://jimblackler.net/blog/?p=567
npm install treefun2
This example generates and adds a diagram to the current document body.
const treefun2 = require('treefun2');
const tree = [{
label: 'World',
children: [{
label: 'Europe',
children: [{
label: 'France',
}, {
label: 'Germany'
}]
}]
}];
treefun2.treeToDiagram(document, document.body, tree, {}, '');
const treefun2 = require('treefun2');
const tree = [{
label: 'World',
children: [{
label: 'Europe',
children: [{
label: 'France',
}, {
label: 'Germany'
}]
}]
}];
const options = {
flipXY: false,
width: 320,
height: 450,
labelLineSpacing: 15,
labelPadding: 2,
arrowHeadWidth: 5,
arrowHeadHeight: 5,
arrowsUp: false,
minimumSiblingGap: 0.1,
idealSiblingGap: 0.1,
minimumCousinGap: 0.2,
idealCousinGap: 1.2,
levelsGap: 1.2,
cornerRounding: 4,
minimumDepth: 0,
minimumBreadth: 0
};
const css = `
text {
text-anchor: middle;
font-size: x-small;
}
rect {
fill: ghostwhite;
stroke: black;
stroke-width: 0.3px;
}
line {
stroke: black;
opacity: 0.5;
stroke-width: 0.3px;
}
`;
treefun2.treeToDiagram(document, document.body, tree, options, css);
Diagrams can be generated in server-side code with the use
of JSDOM. The below example creates a diagram
and writes it to a file diagram.svg
.
npm install jsdom
const fs = require('fs');
const jsdom = require('jsdom');
const treefun2 = require('treefun2');
const document = new jsdom.JSDOM().window.document;
const tree = [{
label: 'World',
children: [{
label: 'Europe',
children: [{
label: 'France',
}, {
label: 'Germany'
}]
}]
}];
treefun2.treeToDiagram(document, document.body, tree, {}, '');
fs.writeFileSync('diagram.svg', document.body.innerHTML);
FAQs
Tree diagram generator
The npm package treefun2 receives a total of 0 weekly downloads. As such, treefun2 popularity was classified as not popular.
We found that treefun2 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
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.