Sha256: 9ae76f958b48a29d925d809a97b4d16d5f6e0d36d1faf8cbc31e8f5270e0310f

Contents?: true

Size: 1.72 KB

Versions: 71

Compression:

Stored size: 1.72 KB

Contents

# archy

Render nested hierarchies `npm ls` style with unicode pipes.

[![browser support](http://ci.testling.com/substack/node-archy.png)](http://ci.testling.com/substack/node-archy)

[![build status](https://secure.travis-ci.org/substack/node-archy.png)](http://travis-ci.org/substack/node-archy)

# example

``` js
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](http://npmjs.org) do:

```
npm install archy
```

# license

MIT

Version data entries

71 entries across 70 versions & 4 rubygems

Version Path
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/archy/readme.markdown
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/archy/readme.markdown
node-compiler-0.9.1 vendor/node/deps/npm/node_modules/archy/README.markdown
node-compiler-0.9.0 vendor/node-v7.2.1/deps/npm/node_modules/archy/README.markdown
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/archy/readme.markdown
node-compiler-0.8.0 vendor/node-v7.2.0/deps/npm/node_modules/archy/README.markdown
trusty-festivity-extension-2.6 node_modules/bower/node_modules/archy/readme.markdown
node-compiler-0.7.0 vendor/node-v7.1.0/deps/npm/node_modules/archy/README.markdown
node-compiler-0.7.0 vendor/node-v6.9.1/deps/npm/node_modules/archy/README.markdown
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/archy/readme.markdown
trusty-festivity-extension-2.5.18 node_modules/bower/node_modules/archy/readme.markdown
trusty-festivity-extension-2.5.17 node_modules/bower/node_modules/archy/readme.markdown
trusty-festivity-extension-2.5.16 node_modules/bower/node_modules/archy/readme.markdown
trusty-festivity-extension-2.5.15 node_modules/bower/node_modules/archy/readme.markdown
trusty-festivity-extension-2.5.14 node_modules/bower/node_modules/archy/readme.markdown
trusty-festivity-extension-2.5.13 node_modules/bower/node_modules/archy/readme.markdown
trusty-festivity-extension-2.5.12 node_modules/bower/node_modules/archy/readme.markdown
trusty-festivity-extension-2.5.11 node_modules/bower/node_modules/archy/readme.markdown
trusty-festivity-extension-2.5.10 node_modules/bower/node_modules/archy/readme.markdown
trusty-festivity-extension-2.5.9 node_modules/bower/node_modules/archy/readme.markdown