New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bant-normalize

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bant-normalize - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

21

index.js

@@ -5,2 +5,3 @@ var through = require('through2');

var toposort = require('toposort');
var debug = require('debug')('bant:normalize');

@@ -17,3 +18,3 @@

if (isVinylBuffer(row) && row.isBuffer()) {
var basedir = row.base;
var basedir = path.dirname(row.path);
row = JSON.parse(row.contents);

@@ -39,3 +40,3 @@ row.basedir = basedir;

row.basedir = basedir;
row.id = defined(row.id, 'module_' + i);
row.name = defined(row.name, 'module_' + i);
row.locals = defined(row.locals, []);

@@ -46,4 +47,3 @@

file: row.main,
expose: defined(row.expose, row.id),
entry: true
expose: defined(row.expose, row.name)
};

@@ -56,2 +56,3 @@

row.main = obj;
scripts.push(obj);

@@ -70,12 +71,12 @@ }

nodes.push(row.id);
row.locals.forEach(function (id) {
edges.push([row.id, id]);
nodes.push(row.name);
row.locals.forEach(function (name) {
edges.push([row.name, name]);
});
index[row.id] = row;
index[row.name] = row;
});
rows = toposort.array(nodes, edges).reverse().map(function (id) {
return index[id];
rows = toposort.array(nodes, edges).reverse().map(function (name) {
return index[name];
});

@@ -82,0 +83,0 @@

{
"name": "bant-normalize",
"version": "0.1.1",
"version": "0.1.2",
"description": "",

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

@@ -10,8 +10,7 @@ var normalize = require('..');

tr.pipe(normalize({ basedir: __dirname })).pipe(through.obj(function (row, enc, cb) {
rows[row.id] = row;
rows[row.name] = row;
cb();
}, function () {
t.equal(rows.x.scripts[0].file, __dirname + '/x.js');
t.equal(rows.x.scripts[0].entry, true);
t.equal(rows.x.scripts[0].expose, rows.x.id);
t.equal(rows.x.scripts[0].expose, rows.x.name);
t.equal(rows.y.basedir, path.resolve(__dirname + '/../'));

@@ -24,6 +23,6 @@ t.equal(rows.y.scripts.length, 2);

tr.write({ id: 'x', main: 'x.js' });
tr.write({ id: 'y', basedir: __dirname + '/../', scripts: ['y.js', 'z.js'] });
tr.write({ name: 'x', main: 'x.js' });
tr.write({ name: 'y', basedir: __dirname + '/../', scripts: ['y.js', 'z.js'] });
tr.write({ main: 'z.js', expose: 'z' });
tr.end();
});

@@ -13,14 +13,14 @@ var normalize = require('..');

}, function () {
t.equal(rows[0].id, 'w');
t.equal(rows[1].id, 'z');
t.equal(rows[2].id, 'y');
t.equal(rows[3].id, 'x');
t.equal(rows[0].name, 'w');
t.equal(rows[1].name, 'z');
t.equal(rows[2].name, 'y');
t.equal(rows[3].name, 'x');
t.end();
}));
tr.write({ id: 'x', locals: ['w', 'y'] });
tr.write({ id: 'y', locals: ['z'] });
tr.write({ id: 'z', locals: [] });
tr.write({ id: 'w' });
tr.write({ name: 'x', locals: ['w', 'y'] });
tr.write({ name: 'y', locals: ['z'] });
tr.write({ name: 'z', locals: [] });
tr.write({ name: 'w' });
tr.end();
});

@@ -12,3 +12,3 @@ var normalize = require('..');

.pipe(through.obj(function (row, enc, cb) {
rows[row.id] = row;
rows[row.name] = row;
cb();

@@ -15,0 +15,0 @@ }, function () {

{
"id": "x", "main": "x.js"
"name": "x", "main": "x.js"
}
{
"id": "y", "main": "y.js"
"name": "y", "main": "y.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