Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

archy

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

archy - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

test/non_unicode.js

25

index.js

@@ -1,7 +0,20 @@

module.exports = function archy (obj, prefix) {
module.exports = function archy (obj, prefix, opts) {
if (prefix === undefined) prefix = '';
if (!opts) opts = {};
var chr = function (s) {
var chars = {
'│' : '|',
'└' : '`',
'├' : '+',
'─' : '-',
'┬' : '-'
};
return opts.unicode === false ? chars[s] : s;
};
if (typeof obj === 'string') obj = { label : obj };
var nodes = obj.nodes || [];
var lines = (obj.label || '').split('\n');
var splitter = '\n' + prefix + (nodes.length ? '│' : ' ') + ' ';
var splitter = '\n' + prefix + (nodes.length ? chr('│') : ' ') + ' ';

@@ -13,8 +26,8 @@ return prefix

var more = node.nodes && node.nodes.length;
var prefix_ = prefix + (last ? ' ' : '│') + ' ';
var prefix_ = prefix + (last ? ' ' : chr('│')) + ' ';
return prefix
+ (last ? '└' : '├') + '─'
+ (more ? '┬' : '─') + ' '
+ archy(node, prefix_).slice(prefix.length + 2)
+ (last ? chr('└') : chr('├')) + chr('─')
+ (more ? chr('┬') : chr('─')) + ' '
+ archy(node, prefix_, opts).slice(prefix.length + 2)
;

@@ -21,0 +34,0 @@ }).join('')

{
"name" : "archy",
"version" : "0.0.1",
"version" : "0.0.2",
"description" : "render nested hierarchies `npm ls` style with unicode pipes",

@@ -5,0 +5,0 @@ "main" : "index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc