diff options
Diffstat (limited to 'node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js')
| -rw-r--r-- | node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js b/node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js index f597cce9..1bcf9da2 100644 --- a/node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js +++ b/node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js @@ -91,10 +91,10 @@ var _default = exports.default = (0, _helperPluginUtils.declare)((api, options) right.replaceWith(_core.types.sequenceExpression([right.node, getAssertion(localName)])); } else if (left.isPattern()) { const ids = left.getOuterBindingIdentifiers(); - const localName = Object.keys(ids).filter(localName => { + const localName = Object.keys(ids).find(localName => { if (localName !== "module" && localName !== "exports") return false; return this.scope.getBinding(localName) === path.scope.getBinding(localName); - })[0]; + }); if (localName) { const right = path.get("right"); right.replaceWith(_core.types.sequenceExpression([right.node, getAssertion(localName)])); @@ -183,7 +183,7 @@ var _default = exports.default = (0, _helperPluginUtils.declare)((api, options) (0, _helperModuleTransforms.ensureStatementsHoisted)(headers); path.unshiftContainer("body", headers); path.get("body").forEach(path => { - if (headers.indexOf(path.node) === -1) return; + if (!headers.includes(path.node)) return; if (path.isVariableDeclaration()) { path.scope.registerDeclaration(path); } |
