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

detective

Package Overview
Dependencies
Maintainers
1
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 2.0.0 to 2.1.0

2

index.js

@@ -47,2 +47,3 @@ var esprima = require('esprima');

var modules = { strings : [], expressions : [] };
if (opts.nodes) modules.nodes = [];

@@ -60,2 +61,3 @@ if (src.indexOf(word) == -1) return modules;

}
if (opts.nodes) modules.nodes.push(node);
});

@@ -62,0 +64,0 @@

2

package.json
{
"name" : "detective",
"description" : "Find all calls to require() no matter how crazily nested using a proper walk of the AST",
"version" : "2.0.0",
"version" : "2.1.0",
"repository" : {

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

@@ -10,3 +10,18 @@ var test = require('tap').test;

t.deepEqual(modules.expressions, [ "'c' + x", "'d' + y" ]);
t.notOk(modules.nodes, 'has no nodes');
t.end();
});
test('both with nodes specified in opts', function (t) {
var modules = detective.find(src, { nodes: true });
t.deepEqual(modules.strings, [ 'a', 'b' ]);
t.deepEqual(modules.expressions, [ "'c' + x", "'d' + y" ]);
t.deepEqual(
modules.nodes.map(function (n) {
var arg = n.arguments[0];
return arg.value || arg.left.value;
}),
[ 'a', 'b', 'c', 'd' ],
'has a node for each require');
t.end();
});

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