babel/packages/babel-plugin-transform-parameters
Vedant Roy aea0fcd599
Correctly transpile when cross-param refs with obj rest (#11326)
* Transform initializers with ids in rest elements

Fix issue 11281. Transform parameters with default initializers that
have ids that are also in a parameter with a rest element.
Before, these parameters were not transformed.

* Add plugin-transform-parameters as dependency

* Remove outdated comment

* Use set instead of array for paramsWithRestElement

* Skip when encounter "Scope"

Previously, f({...R}, f = R => R) would be incorrectly transformed.

* Pass in loose mode option instead of false

* Address review and re-organize tests

Checking the RHS of an assignment pattern/checking the parent of
an identifier node fails on cases like "({...R}, a = f(R))" or
"({...R}, {[R.key]: a = 42})".

Also refactor tests by removing unecessary tests and
separating "should transform" from "should not transform" tests.
2020-04-07 21:06:43 +02:00
..
2020-03-22 11:57:58 +01:00

@babel/plugin-transform-parameters

Compile ES2015 default and rest parameters to ES5

See our website @babel/plugin-transform-parameters for more information.

Install

Using npm:

npm install --save-dev @babel/plugin-transform-parameters

or using yarn:

yarn add @babel/plugin-transform-parameters --dev