estraverse
Advanced tools
Comparing version 4.2.0 to 4.3.0
@@ -32,7 +32,4 @@ /* | ||
var Syntax, | ||
isArray, | ||
VisitorOption, | ||
VisitorKeys, | ||
objectCreate, | ||
objectKeys, | ||
BREAK, | ||
@@ -42,11 +39,2 @@ SKIP, | ||
function ignoreJSHintError() { } | ||
isArray = Array.isArray; | ||
if (!isArray) { | ||
isArray = function isArray(array) { | ||
return Object.prototype.toString.call(array) === '[object Array]'; | ||
}; | ||
} | ||
function deepCopy(obj) { | ||
@@ -67,13 +55,2 @@ var ret = {}, key, val; | ||
function shallowCopy(obj) { | ||
var ret = {}, key; | ||
for (key in obj) { | ||
if (obj.hasOwnProperty(key)) { | ||
ret[key] = obj[key]; | ||
} | ||
} | ||
return ret; | ||
} | ||
ignoreJSHintError(shallowCopy); | ||
// based on LLVM libc++ upper_bound / lower_bound | ||
@@ -101,48 +78,2 @@ // MIT License | ||
function lowerBound(array, func) { | ||
var diff, len, i, current; | ||
len = array.length; | ||
i = 0; | ||
while (len) { | ||
diff = len >>> 1; | ||
current = i + diff; | ||
if (func(array[current])) { | ||
i = current + 1; | ||
len -= diff + 1; | ||
} else { | ||
len = diff; | ||
} | ||
} | ||
return i; | ||
} | ||
ignoreJSHintError(lowerBound); | ||
objectCreate = Object.create || (function () { | ||
function F() { } | ||
return function (o) { | ||
F.prototype = o; | ||
return new F(); | ||
}; | ||
})(); | ||
objectKeys = Object.keys || function (o) { | ||
var keys = [], key; | ||
for (key in o) { | ||
keys.push(key); | ||
} | ||
return keys; | ||
}; | ||
function extend(to, from) { | ||
var keys = objectKeys(from), key, i, len; | ||
for (i = 0, len = keys.length; i < len; i += 1) { | ||
key = keys[i]; | ||
to[key] = from[key]; | ||
} | ||
return to; | ||
} | ||
Syntax = { | ||
@@ -184,2 +115,3 @@ AssignmentExpression: 'AssignmentExpression', | ||
IfStatement: 'IfStatement', | ||
ImportExpression: 'ImportExpression', | ||
ImportDeclaration: 'ImportDeclaration', | ||
@@ -259,2 +191,3 @@ ImportDefaultSpecifier: 'ImportDefaultSpecifier', | ||
IfStatement: ['test', 'consequent', 'alternate'], | ||
ImportExpression: ['source'], | ||
ImportDeclaration: ['specifiers', 'source'], | ||
@@ -319,3 +252,3 @@ ImportDefaultSpecifier: ['local'], | ||
Reference.prototype.remove = function remove() { | ||
if (isArray(this.parent)) { | ||
if (Array.isArray(this.parent)) { | ||
this.parent.splice(this.key, 1); | ||
@@ -344,3 +277,3 @@ return true; | ||
function addToPath(result, path) { | ||
if (isArray(path)) { | ||
if (Array.isArray(path)) { | ||
for (j = 0, jz = path.length; j < jz; ++j) { | ||
@@ -445,3 +378,3 @@ result.push(path[j]); | ||
if (visitor.fallback === 'iteration') { | ||
this.__fallback = objectKeys; | ||
this.__fallback = Object.keys; | ||
} else if (typeof visitor.fallback === 'function') { | ||
@@ -453,3 +386,3 @@ this.__fallback = visitor.fallback; | ||
if (visitor.keys) { | ||
this.__keys = extend(objectCreate(this.__keys), visitor.keys); | ||
this.__keys = Object.assign(Object.create(this.__keys), visitor.keys); | ||
} | ||
@@ -543,3 +476,3 @@ }; | ||
if (isArray(candidate)) { | ||
if (Array.isArray(candidate)) { | ||
current2 = candidate.length; | ||
@@ -698,3 +631,3 @@ while ((current2 -= 1) >= 0) { | ||
if (isArray(candidate)) { | ||
if (Array.isArray(candidate)) { | ||
current2 = candidate.length; | ||
@@ -701,0 +634,0 @@ while ((current2 -= 1) >= 0) { |
@@ -6,5 +6,5 @@ { | ||
"main": "estraverse.js", | ||
"version": "4.2.0", | ||
"version": "4.3.0", | ||
"engines": { | ||
"node": ">=0.10.0" | ||
"node": ">=4.0" | ||
}, | ||
@@ -23,3 +23,3 @@ "maintainers": [ | ||
"devDependencies": { | ||
"babel-preset-es2015": "^6.3.13", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-register": "^6.3.13", | ||
@@ -32,3 +32,3 @@ "chai": "^2.1.1", | ||
"gulp-git": "^1.0.1", | ||
"gulp-tag-version": "^1.2.1", | ||
"gulp-tag-version": "^1.3.0", | ||
"jshint": "^2.5.6", | ||
@@ -35,0 +35,0 @@ "mocha": "^2.1.0" |
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
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
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
36325
0
154
737