lib/condenser/processors/node_modules/@babel/traverse/lib/path/context.js in condenser-0.0.4 vs lib/condenser/processors/node_modules/@babel/traverse/lib/path/context.js in condenser-0.0.5
- old
+ new
@@ -27,11 +27,11 @@
var _index = _interopRequireDefault(require("../index"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function call(key) {
- var opts = this.opts;
+ const opts = this.opts;
this.debug(key);
if (this.node) {
if (this._call(opts[key])) return true;
}
@@ -44,45 +44,33 @@
}
function _call(fns) {
if (!fns) return false;
- for (var _iterator = fns, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
- var _ref;
-
- if (_isArray) {
- if (_i >= _iterator.length) break;
- _ref = _iterator[_i++];
- } else {
- _i = _iterator.next();
- if (_i.done) break;
- _ref = _i.value;
- }
-
- var fn = _ref;
+ for (const fn of fns) {
if (!fn) continue;
- var node = this.node;
+ const node = this.node;
if (!node) return true;
- var ret = fn.call(this.state, this, this.state);
+ const ret = fn.call(this.state, this, this.state);
if (ret && typeof ret === "object" && typeof ret.then === "function") {
- throw new Error("You appear to be using a plugin with an async traversal visitor, " + "which your current version of Babel does not support." + "If you're using a published plugin, you may need to upgrade " + "your @babel/core version.");
+ throw new Error(`You appear to be using a plugin with an async traversal visitor, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`);
}
if (ret) {
- throw new Error("Unexpected return value from visitor method " + fn);
+ throw new Error(`Unexpected return value from visitor method ${fn}`);
}
if (this.node !== node) return true;
if (this.shouldStop || this.shouldSkip || this.removed) return true;
}
return false;
}
function isBlacklisted() {
- var blacklist = this.opts.blacklist;
+ const blacklist = this.opts.blacklist;
return blacklist && blacklist.indexOf(this.node.type) > -1;
}
function visit() {
if (!this.node) {
@@ -123,12 +111,12 @@
this.shouldSkip = true;
}
function setScope() {
if (this.opts && this.opts.noScope) return;
- var path = this.parentPath;
- var target;
+ let path = this.parentPath;
+ let target;
while (path && !target) {
if (path.opts && path.opts.noScope) return;
target = path.scope;
path = path.parentPath;
@@ -173,17 +161,17 @@
function _resyncKey() {
if (!this.container) return;
if (this.node === this.container[this.key]) return;
if (Array.isArray(this.container)) {
- for (var i = 0; i < this.container.length; i++) {
+ for (let i = 0; i < this.container.length; i++) {
if (this.container[i] === this.node) {
return this.setKey(i);
}
}
} else {
- for (var key in this.container) {
+ for (const key of Object.keys(this.container)) {
if (this.container[key] === this.node) {
return this.setKey(key);
}
}
}
@@ -191,11 +179,11 @@
this.key = null;
}
function _resyncList() {
if (!this.parent || !this.inList) return;
- var newContainer = this.parent[this.listKey];
+ const newContainer = this.parent[this.listKey];
if (this.container === newContainer) return;
this.container = newContainer || null;
}
function _resyncRemoved() {
@@ -232,37 +220,21 @@
this.key = key;
this.node = this.container[this.key];
this.type = this.node && this.node.type;
}
-function requeue(pathToQueue) {
- if (pathToQueue === void 0) {
- pathToQueue = this;
- }
-
+function requeue(pathToQueue = this) {
if (pathToQueue.removed) return;
- var contexts = this.contexts;
+ const contexts = this.contexts;
- for (var _iterator2 = contexts, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
- var _ref2;
-
- if (_isArray2) {
- if (_i2 >= _iterator2.length) break;
- _ref2 = _iterator2[_i2++];
- } else {
- _i2 = _iterator2.next();
- if (_i2.done) break;
- _ref2 = _i2.value;
- }
-
- var context = _ref2;
+ for (const context of contexts) {
context.maybeQueue(pathToQueue);
}
}
function _getQueueContexts() {
- var path = this;
- var contexts = this.contexts;
+ let path = this;
+ let contexts = this.contexts;
while (!contexts.length) {
path = path.parentPath;
if (!path) break;
contexts = path.contexts;
\ No newline at end of file