Comparing version 0.0.3 to 0.0.4
17
index.js
var burrito = require('burrito'); | ||
var exports = module.exports = function (src) { | ||
return exports.find(src).strings; | ||
var exports = module.exports = function (src, opts) { | ||
return exports.find(src, opts).strings; | ||
}; | ||
exports.find = function (src) { | ||
exports.find = function (src, opts) { | ||
if (!opts) opts = {}; | ||
var word = opts.word === undefined ? 'require' : opts.word; | ||
var modules = { strings : [], expressions : [] }; | ||
if (src.toString().indexOf('require') == -1) return modules; | ||
if (src.toString().indexOf(word) == -1) return modules; | ||
@@ -15,3 +18,3 @@ burrito(src, function (node) { | ||
&& node.value[0][0] === 'name' | ||
&& node.value[0][1] === 'require' | ||
&& node.value[0][1] === word | ||
; | ||
@@ -32,3 +35,3 @@ if (isRequire) { | ||
&& node.value[0][1][0] === 'name' | ||
&& node.value[0][1][1] === 'require' | ||
&& node.value[0][1][1] === word | ||
; | ||
@@ -50,3 +53,3 @@ | ||
&& node.value[0][1][1][0] === 'name' | ||
&& node.value[0][1][1][1] === 'require' | ||
&& node.value[0][1][1][1] === word | ||
; | ||
@@ -53,0 +56,0 @@ if (isDotCallRequire) { |
{ | ||
"name" : "detective", | ||
"description" : "Find all calls to require() no matter how crazily nested using a proper walk of the AST", | ||
"version" : "0.0.3", | ||
"version" : "0.0.4", | ||
"repository" : { | ||
@@ -6,0 +6,0 @@ "type" : "git", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
65
0
6334
13
139
2