
Security News
TC39 Advances 11 Proposals for Math Precision, Binary APIs, and More
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
displayastree
Advanced tools
Simple way to display data as a tree structure.
Screenshot taken from DevScript to be used as an example.
You are able to pass strings that are colored using Chalk.
# global
npm i -g displayastree
# npm
npm i displayastree
# yarn
yarn add displayastree
import { Tree, Branch } from "displayastree";
//* Chalk is not needed but is just used in this example.
import chalk from "chalk";
//* Make the main tree.
const tree = new Tree(chalk.hex("#FF8C00")("Found 2 TODO's"));
//* Make branches.
const branchOne = new Branch(chalk.cyan("config.ts")).addBranch([chalk.yellow("src/config.ts")]);
const branchTwo = new Branch(chalk.cyan("index.ts")).addBranch([chalk.yellow("src/modules/status/index.ts")]);
//* Add the branches to the main tree and log
tree.addBranch([branchOne, branchTwo]).log();
Will log:
new Tree("A test").addBranch(["a", "b", "c"]).log();
Will log:
Simply include the options while creating the Tree instance.
const tree = new Tree("Tree Name", { headChar: "* " });
Options | Type | Description | Default |
---|---|---|---|
headChar | string | String of the character that the tree will start with. | ● |
treeChar | string | String of the character that the tree will split with. | ├─ |
lineChar | string | String of the character that the tree will display at overlaps. | │ |
lastChar | string | String of the character that the tree will end with. | ╰─ |
Note: treeChar, lineChar, and lastChar must have the same length.
FAQs
Simple way to display data as a tree structure.
The npm package displayastree receives a total of 130 weekly downloads. As such, displayastree popularity was classified as not popular.
We found that displayastree 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
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.