@babel/plugin-transform-destructuring
Advanced tools
Comparing version 7.24.8 to 7.25.7
@@ -108,3 +108,35 @@ 'use strict'; | ||
} else { | ||
return this.scope.toArray(node, count, this.arrayLikeIsIterable); | ||
const { | ||
scope, | ||
arrayLikeIsIterable | ||
} = this; | ||
if (core.types.isIdentifier(node)) { | ||
const binding = scope.getBinding(node.name); | ||
if (binding != null && binding.constant && binding.path.isGenericType("Array")) { | ||
return node; | ||
} | ||
} | ||
if (core.types.isArrayExpression(node)) { | ||
return node; | ||
} | ||
if (core.types.isIdentifier(node, { | ||
name: "arguments" | ||
})) { | ||
return core.template.expression.ast` | ||
Array.prototype.slice.call(${node}) | ||
`; | ||
} | ||
let helperName; | ||
const args = [node]; | ||
if (typeof count === "number") { | ||
args.push(core.types.numericLiteral(count)); | ||
helperName = "slicedToArray"; | ||
} else { | ||
helperName = "toArray"; | ||
} | ||
if (arrayLikeIsIterable) { | ||
args.unshift(scope.path.hub.addHelper(helperName)); | ||
helperName = "maybeArrayLike"; | ||
} | ||
return core.types.callExpression(scope.path.hub.addHelper(helperName), args); | ||
} | ||
@@ -111,0 +143,0 @@ } |
{ | ||
"name": "@babel/plugin-transform-destructuring", | ||
"version": "7.24.8", | ||
"version": "7.25.7", | ||
"description": "Compile ES2015 destructuring to ES5", | ||
@@ -20,3 +20,3 @@ "repository": { | ||
"dependencies": { | ||
"@babel/helper-plugin-utils": "^7.24.8" | ||
"@babel/helper-plugin-utils": "^7.25.7" | ||
}, | ||
@@ -27,5 +27,5 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@babel/core": "^7.24.8", | ||
"@babel/helper-plugin-test-runner": "^7.24.7", | ||
"@babel/traverse": "^7.24.8" | ||
"@babel/core": "^7.25.7", | ||
"@babel/helper-plugin-test-runner": "^7.25.7", | ||
"@babel/traverse": "^7.25.7" | ||
}, | ||
@@ -32,0 +32,0 @@ "engines": { |
@@ -15,4 +15,7 @@ /* This file is automatically generated by scripts/generators/tsconfig.js */ | ||
"path": "../../packages/babel-helper-plugin-utils" | ||
}, | ||
{ | ||
"path": "../../packages/babel-core" | ||
} | ||
] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
156047
591
+ Addedelectron-to-chromium@1.5.63(transitive)
- Removedelectron-to-chromium@1.5.62(transitive)