test/dummy/node_modules/@babel/traverse/lib/path/ancestry.js in disco_app-0.18.0 vs test/dummy/node_modules/@babel/traverse/lib/path/ancestry.js in disco_app-0.18.1

- old
+ new

@@ -12,20 +12,18 @@ exports.getAncestry = getAncestry; exports.isAncestor = isAncestor; exports.isDescendant = isDescendant; exports.inType = inType; -var t = _interopRequireWildcard(require("@babel/types")); +var _t = require("@babel/types"); -var _index = _interopRequireDefault(require("./index")); +var _index = require("./index"); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +const { + VISITOR_KEYS +} = _t; -function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - function findParent(callback) { let path = this; while (path = path.parentPath) { if (callback(path)) return path; @@ -67,11 +65,11 @@ } function getEarliestCommonAncestorFrom(paths) { return this.getDeepestCommonAncestorFrom(paths, function (deepest, i, ancestries) { let earliest; - const keys = t.VISITOR_KEYS[deepest.type]; + const keys = VISITOR_KEYS[deepest.type]; for (const ancestry of ancestries) { const path = ancestry[i + 1]; if (!earliest) { @@ -165,14 +163,14 @@ function isDescendant(maybeAncestor) { return !!this.findParent(parent => parent === maybeAncestor); } -function inType() { +function inType(...candidateTypes) { let path = this; while (path) { - for (const type of arguments) { + for (const type of candidateTypes) { if (path.node.type === type) return true; } path = path.parentPath; } \ No newline at end of file