1. archy
render nested hierarchies `npm ls` style with unicode pipes
archy
Package: archy
Created by: substack
Last modified: Sun, 05 Mar 2023 20:15:52 GMT
Version: 1.0.0
License: MIT
Downloads: 27,327,406
Repository: https://github.com/substack/node-archy

Install

npm install archy
yarn add archy

archy

Render nested hierarchies npm ls style with unicode pipes.

browser support

build status

example

 var archy = require('archy');
var s = archy({
  label : 'beep',
  nodes : [
    'ity',
    {
      label : 'boop',
      nodes : [
        {
          label : 'o_O',
          nodes : [
            {
              label : 'oh',
              nodes : [ 'hello', 'puny' ]
            },
            'human'
          ]
        },
        'party\ntime!'
      ]
    }
  ]
});
console.log(s);

output

beep
├── ity
└─┬ boop
  ├─┬ o_O
  │ ├─┬ oh
  │ │ ├── hello
  │ │ └── puny
  │ └── human
  └── party
      time!

methods

var archy = require('archy')

archy(obj, prefix='', opts={})

Return a string representation of obj with unicode pipe characters like how
npm ls looks.

obj should be a tree of nested objects with 'label' and 'nodes' fields.
'label' is a string of text to display at a node level and 'nodes' is an
array of the descendents of the current node.

If a node is a string, that string will be used as the 'label' and an empty
array of 'nodes' will be used.

prefix gets prepended to all the lines and is used by the algorithm to
recursively update.

If 'label' has newlines they will be indented at the present indentation level
with the current prefix.

To disable unicode results in favor of all-ansi output set opts.unicode to
false.

install

With npm do:

npm install archy

license

MIT

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin