archy
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The Archy npm package primarily renders nested hierarchies in a style similar to npm ls
, using unicode pipe characters. It's an excellent tool for developers requiring visual presentation of nested JavaScript objects or arrays in a structured form.
To utilize Archy, start with installing it into your workspace by running npm install archy
in your terminal. Once installed, it can be included in your JavaScript file using var archy = require('archy');
.
The main use of the Archy package revolves around the archy(obj, prefix='', opts={})
function, which accepts an object or an array as a parameter, optionally accompanied by a string prefix and an options object. The object should have 'label' and 'nodes' fields. If a node is a string, that string is used as the 'label', with an empty array of 'nodes'.
Here's an example showcasing the usage of the Archy package:
var archy = require('archy');
var structuredData = archy({
label : 'beep',
nodes : [
'ity',
{
label : 'boop',
nodes : [
{
label : 'o_O',
nodes : [
{
label : 'oh',
nodes : [ 'hello', 'puny' ]
},
'human'
]
},
'party\ntime!'
]
}
]
});
console.log(structuredData);
The result:
beep
├── ity
└─┬ boop
├─┬ o_O
│ ├─┬ oh
│ │ ├── hello
│ │ └── puny
│ └── human
└── party
time!
In case you want to output the results in an all-ansi format, you can set opts.unicode
to false
.
The official documentation for the Archy npm package is not separate but is included in the readme of the package's GitHub repository. The repository's URL is http://github.com/substack/node-archy.git. You'll find usage examples, installation instructions, and the API reference within the readme. Developers seeking to integrate the package into their JavaScript applications can refer to this resource for all necessary information.