babel/packages/babel-plugin-proposal-object-rest-spread
Daniel Kezerashvili 40e43f5a14
fix: Duplicate function call in variable destructuring (#13711)
* Add test case demonstrating invalid behavior

* Add conditional check for child properties so RHS is not duplicated

* Add recursive check to find any nested non single-property case

* Add case for array destructuring

* Add test case for a nested rest element

* More safely recurse through array destructuring

* Traverse assignment and nested rest operations

* Refactor to be more clear which case statement we are executing against

* Update missed snapshots

* Update packages/babel-plugin-proposal-object-rest-spread/src/index.js

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>

* Filter null array elements, add early return, remove optional chaining

* Use stronger type assertions

* Update fall through to be false; add early return to RestElement case

* Move hasMoreThanOneBinding to its own file with distinct tests

* Rename testing helper to more appropriately match business logic

* Yarn Dedup & rename hasMoreThanOneBinding to shouldStoreRHSInTemporaryVariable

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2021-09-07 17:27:52 -04:00
..

@babel/plugin-proposal-object-rest-spread

Compile object rest and spread to ES5

See our website @babel/plugin-proposal-object-rest-spread for more information.

Install

Using npm:

npm install --save-dev @babel/plugin-proposal-object-rest-spread

or using yarn:

yarn add @babel/plugin-proposal-object-rest-spread --dev