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

detective

Package Overview
Dependencies
Maintainers
0
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detective - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

2

example/strings.js

@@ -1,2 +0,2 @@

var detective = require('../');
var detective = require('detective');
var fs = require('fs');

@@ -3,0 +3,0 @@

@@ -25,4 +25,21 @@ var burrito = require('burrito');

}
var isDotRequire = (node.name === 'dot' || node.name === 'call')
&& node.value[0][0] === 'call'
&& node.value[0][1][0] === 'name'
&& node.value[0][1][1] === 'require'
;
if (isDotRequire) {
var expr = node.value[0][2][0];
if (expr[0].name === 'string') {
modules.strings.push(expr[1]);
}
else {
modules.expressions.push(burrito.deparse(expr));
}
}
});
return modules;
};
{
"name" : "detective",
"description" : "Find all calls to require() no matter how crazily nested using a proper walk of the AST",
"version" : "0.0.0",
"version" : "0.0.1",
"repository" : {

@@ -6,0 +6,0 @@ "type" : "git",

@@ -9,3 +9,3 @@ var assert = require('assert');

assert.deepEqual(modules.strings, [ 'a', 'b' ]);
assert.deepEqual(modules.expressions, [ '"c"+x' ]);
assert.deepEqual(modules.expressions, [ '"c"+x', '"d"+y' ]);
};
require('a');
require('b');
require('c'+x);
var moo = require('d'+y).moo;

@@ -1,3 +0,11 @@

require('a');
require('b');
require('c');
var a = require('a');
var b = require('b');
var c = require('c');
var abc = a.b(c);
var EventEmitter = require('events').EventEmitter;
var x = require('doom')(5,6,7);
x(8,9);
c.require('notthis');
var y = require('y') * 100;

@@ -7,3 +7,3 @@ var assert = require('assert');

exports.single = function () {
assert.deepEqual(detective(src), [ 'a', 'b', 'c' ]);
assert.deepEqual(detective(src), [ 'a', 'b', 'c', 'events', 'doom', 'y' ]);
};

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