is-calling-function
Advanced tools
Comparing version 1.0.2 to 1.0.3
19
index.js
@@ -13,14 +13,15 @@ var Walker = require('node-source-walk'); | ||
var isFileCallingFunction = false; | ||
var walker = new Walker({ | ||
ecmaVersion: 6 | ||
}); | ||
var walker = new Walker(); | ||
walker.walk(source, function(node) { | ||
var isCallExpression = node.type === 'ExpressionStatement' && | ||
node.expression.type === 'CallExpression'; | ||
var callee; | ||
if (node.type === 'ExpressionStatement' && | ||
node.expression.type === 'CallExpression') { | ||
callee = node.expression.callee; | ||
} else if (node.type === 'CallExpression') { | ||
callee = node.callee; | ||
} else { | ||
return false; | ||
} | ||
if (!isCallExpression) { return; } | ||
var callee = node.expression.callee; | ||
if (!callee) { return; } | ||
@@ -27,0 +28,0 @@ |
{ | ||
"name": "is-calling-function", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Whether or not a file is calling a particular function", | ||
@@ -28,3 +28,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"node-source-walk": "~1.4.1" | ||
"node-source-walk": "~2.0.0" | ||
}, | ||
@@ -31,0 +31,0 @@ "devDependencies": { |
@@ -14,2 +14,6 @@ var assert = require('assert'); | ||
it('works for es6', function() { | ||
assert.ok(isCallingFunction('() => foo();', 'foo')); | ||
}); | ||
it('works for named iife', function() { | ||
@@ -16,0 +20,0 @@ assert.ok(isCallingFunction('(function foo(){})();', 'foo')); |
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
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
4396
78
+ Addedacorn@2.0.4(transitive)
+ Addednode-source-walk@2.0.0(transitive)
- Removedacorn@1.2.2(transitive)
- Removednode-source-walk@1.4.2(transitive)
Updatednode-source-walk@~2.0.0