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

require-list

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

require-list - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

37

lib/index.js

@@ -53,2 +53,3 @@ /**

function childTree(filepath, level) {
level = level || 0;
if (level > 10) {

@@ -90,16 +91,20 @@ return {};

function convertString(dirname, color, str, childs, level) {
var i, key;
var indent = '';
for (i = 0; i < level; i++) {
indent += ' |';
}
indent += ' ├─ ';
function convertString(dirname, color, str, childs, indent) {
indent = indent || '';
var key, last = Object.keys(childs).pop(), curr_indent, next_indent;
for (key in childs) {
if (key === last) {
curr_indent = indent + '└── ';
next_indent = indent + '    ';
} else {
curr_indent = indent + '├── ';
next_indent = indent + '│   ';
}
if (key === DYNAMIC_LOADING) {
if (color) {
str += indent + COLOR.YELLOW + key + COLOR.RESET + '\n';
str += curr_indent + COLOR.YELLOW + key + COLOR.RESET + '\n';
} else {
str += indent + key + '\n';
str += curr_indent + key + '\n';
}

@@ -111,5 +116,5 @@ continue;

if (color) {
str += indent + COLOR.MAGENTA + key + COLOR.RESET + '\n';
str += curr_indent + COLOR.MAGENTA + key + COLOR.RESET + '\n';
} else {
str += indent + key + '\n';
str += curr_indent + key + '\n';
}

@@ -120,8 +125,8 @@ continue;

if (childs[key]) {
str += indent + path.relative(dirname, key) + '\n';
str = convertString(dirname, color, str, childs[key], level + 1);
str += curr_indent + path.relative(dirname, key) + '\n';
str = convertString(dirname, color, str, childs[key], next_indent);
} else if (color) {
str += indent + COLOR.GREEN + path.relative(dirname, key) + COLOR.RESET + '\n';
str += curr_indent + COLOR.GREEN + path.relative(dirname, key) + COLOR.RESET + '\n';
} else {
str += indent + path.relative(dirname, key) + '\n';
str += curr_indent + path.relative(dirname, key) + '\n';
}

@@ -141,3 +146,3 @@ }

var str = entrypoint + '\n';
return convertString(path.dirname(entrypoint), color, str, tree, 0);
return convertString(path.dirname(entrypoint), color, str, tree);
};
{
"name": "require-list",
"version": "0.1.1",
"version": "0.1.2",
"description": "require tree list",

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

@@ -42,6 +42,6 @@ Require List

/tmp/a.js
├─ b.js
| ├─ test/c.js
├─ test/index.js
| ├─ test/c.js
├── b.js
| └── test/c.js
└── test/index.js
└── test/c.js
```

@@ -67,6 +67,6 @@

// /tmp/a.js
// ├─ b.js
// | ├─ test/c.js
// ├─ test/index.js
// | ├─ test/c.js
// ├── b.js
// | └── test/c.js
// └── test/index.js
// └── test/c.js
```

@@ -79,3 +79,3 @@

4. Rebase your local changes against the master branch
5. Run test suite with the `npm test; npm run-script jshint` command and confirm that it passes
5. Run test suite with the `npm test; npm run jshint` command and confirm that it passes
5. Create new Pull Request

@@ -25,8 +25,8 @@ var path = require('path');

var expect = path.join(__dirname, './data/index.js') + '\n';
expect += ' ├─ path\n';
expect += ' ├─ esprima\n';
expect += ' ├─ a.js\n';
expect += ' | ├─ b/index.js\n';
expect += ' | | ├─ c.json\n';
expect += ' | ├─ c.json\n';
expect += '├── path\n';
expect += '├── esprima\n';
expect += '└── a.js\n';
expect += '    ├── b/index.js\n';
expect += '    │   └── c.json\n';
expect += '    └── c.json\n';

@@ -33,0 +33,0 @@ assert.equal(result, expect);

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