Comparing version 2.2.0 to 2.2.1
@@ -92,5 +92,8 @@ /** | ||
if (flags.length && node.type === 'MemberExpression') { | ||
return node.object.type === 'Identifier' && node.object.name === word | ||
&& ((node.property.type === 'Identifier' && flags.indexOf(node.property.name) !== -1) | ||
|| (node.property.type === 'Literal' && flags.indexOf(node.property.value) !== -1)); | ||
return ( | ||
node.object.type === 'Identifier' && | ||
node.object.name === word && | ||
((node.property.type === 'Identifier' && flags.indexOf(node.property.name) !== -1) || | ||
(node.property.type === 'Literal' && flags.indexOf(node.property.value) !== -1)) | ||
); | ||
} else { | ||
@@ -122,3 +125,3 @@ return node.type === 'Identifier' && node.name === word; | ||
if (!utils.string(options.word)) options.word = 'require'; | ||
if (!(new RegExp('\\b' + options.word + '\\b')).test(src)) return deps; | ||
if (!new RegExp('\\b' + options.word + '\\b').test(src)) return deps; | ||
if (!Array.isArray(options.flags)) options.flags = []; | ||
@@ -150,3 +153,3 @@ if (replace && !utils.fn(replace)) replace = utils.noop; | ||
// Walk code | ||
walk(src, options.parse, (node) => { | ||
walk(src, options.parse, node => { | ||
if (isRequire(node, options.word, options.flags)) { | ||
@@ -164,3 +167,3 @@ let args = node.arguments; | ||
} else if (args.type === 'ArrayExpression') { | ||
args.elements.forEach((args) => { | ||
args.elements.forEach(args => { | ||
if (args.type === 'Literal') { | ||
@@ -167,0 +170,0 @@ handle(args, flag); |
{ | ||
"name": "cmd-deps", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "Transform cmd and get cmd dependences", | ||
@@ -23,10 +23,3 @@ "author": { | ||
"main": "index", | ||
"keywords": [ | ||
"cmd", | ||
"require", | ||
"common", | ||
"commonjs", | ||
"transform", | ||
"dependencies" | ||
], | ||
"keywords": ["cmd", "require", "common", "commonjs", "transform", "dependencies"], | ||
"dependencies": { | ||
@@ -33,0 +26,0 @@ "acorn": "^5.2.1" |
10499
7
241