babel-plugin-transform-object-rest-spread
Advanced tools
Comparing version 7.0.0-alpha.1 to 7.0.0-alpha.3
{ | ||
"name": "babel-plugin-transform-object-rest-spread", | ||
"version": "7.0.0-alpha.1", | ||
"version": "7.0.0-alpha.3", | ||
"description": "Compile object rest and spread to ES5", | ||
@@ -12,7 +12,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-object-rest-spread", | ||
"dependencies": { | ||
"babel-plugin-syntax-object-rest-spread": "7.0.0-alpha.1" | ||
"babel-plugin-syntax-object-rest-spread": "7.0.0-alpha.3" | ||
}, | ||
"devDependencies": { | ||
"babel-helper-plugin-test-runner": "7.0.0-alpha.1" | ||
"babel-helper-plugin-test-runner": "7.0.0-alpha.3" | ||
} | ||
} |
@@ -7,4 +7,5 @@ # babel-plugin-transform-object-rest-spread | ||
### Rest Properties | ||
```js | ||
// Rest properties | ||
let { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 }; | ||
@@ -14,4 +15,7 @@ console.log(x); // 1 | ||
console.log(z); // { a: 3, b: 4 } | ||
``` | ||
// Spread properties | ||
### Spread Properties | ||
```js | ||
let n = { x, y, ...z }; | ||
@@ -21,3 +25,2 @@ console.log(n); // { x: 1, y: 2, a: 3, b: 4 } | ||
## Installation | ||
@@ -41,8 +44,26 @@ | ||
### Via CLI | ||
```sh | ||
babel --plugins transform-object-rest-spread script.js | ||
``` | ||
### Via Node API | ||
```javascript | ||
require("babel-core").transform("code", { | ||
plugins: ["transform-object-rest-spread"] | ||
}); | ||
``` | ||
## Options | ||
This plugin will use babel's `extends` helper, which will polyfill `Object.assign` by default. | ||
### `useBuiltIns` | ||
* `useBuiltIns` - Do not use Babel's helper's and just transform to use the built-in method (Disabled by default). | ||
`boolean`, defaults to `false`. | ||
By default, this plugin uses Babel's `extends` helper which polyfills `Object.assign`. Enabling this option will use `Object.assign` directly. | ||
**.babelrc** | ||
```json | ||
@@ -56,23 +77,14 @@ { | ||
**In** | ||
```js | ||
// source | ||
z = { x, ...y }; | ||
// compiled | ||
z = Object.assign({ x }, y); | ||
``` | ||
### Via CLI | ||
**Out** | ||
```sh | ||
babel --plugins transform-object-rest-spread script.js | ||
```js | ||
z = Object.assign({ x }, y); | ||
``` | ||
### Via Node API | ||
```javascript | ||
require("babel-core").transform("code", { | ||
plugins: ["transform-object-rest-spread"] | ||
}); | ||
``` | ||
## References | ||
@@ -79,0 +91,0 @@ |
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
11072
89
+ Addedbabel-plugin-syntax-object-rest-spread@7.0.0-alpha.3(transitive)
- Removedbabel-plugin-syntax-object-rest-spread@7.0.0-alpha.1(transitive)