@babel/plugin-proposal-object-rest-spread
Advanced tools
Comparing version 7.9.5 to 7.9.6
@@ -421,23 +421,2 @@ "use strict"; | ||
if (!hasSpread(path.node)) return; | ||
const args = []; | ||
let props = []; | ||
function push() { | ||
args.push(_core.types.objectExpression(props)); | ||
props = []; | ||
} | ||
for (const prop of path.node.properties) { | ||
if (_core.types.isSpreadElement(prop)) { | ||
push(); | ||
args.push(prop.argument); | ||
} else { | ||
props.push(prop); | ||
} | ||
} | ||
if (props.length) { | ||
push(); | ||
} | ||
let helper; | ||
@@ -456,3 +435,31 @@ | ||
path.replaceWith(_core.types.callExpression(helper, args)); | ||
let exp = null; | ||
let props = []; | ||
function make() { | ||
const hadProps = props.length > 0; | ||
const obj = _core.types.objectExpression(props); | ||
props = []; | ||
if (!exp) { | ||
exp = _core.types.callExpression(helper, [obj]); | ||
return; | ||
} | ||
exp = _core.types.callExpression(_core.types.cloneNode(helper), [exp, ...(hadProps ? [_core.types.objectExpression([]), obj] : [])]); | ||
} | ||
for (const prop of path.node.properties) { | ||
if (_core.types.isSpreadElement(prop)) { | ||
make(); | ||
exp.arguments.push(prop.argument); | ||
} else { | ||
props.push(prop); | ||
} | ||
} | ||
if (props.length) make(); | ||
path.replaceWith(exp); | ||
} | ||
@@ -459,0 +466,0 @@ |
{ | ||
"name": "@babel/plugin-proposal-object-rest-spread", | ||
"version": "7.9.5", | ||
"version": "7.9.6", | ||
"description": "Compile object rest and spread to ES5", | ||
@@ -23,6 +23,6 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-object-rest-spread", | ||
"devDependencies": { | ||
"@babel/core": "^7.9.0", | ||
"@babel/core": "^7.9.6", | ||
"@babel/helper-plugin-test-runner": "^7.8.3" | ||
}, | ||
"gitHead": "5b97e77e030cf3853a147fdff81844ea4026219d" | ||
"gitHead": "9c2846bcacc75aa931ea9d556950c2113765d43d" | ||
} |
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
18159
371