Socket
Socket
Sign inDemoInstall

babel-plugin-transform-object-rest-spread

Package Overview
Dependencies
Maintainers
6
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-object-rest-spread - npm Package Compare versions

Comparing version 7.0.0-alpha.1 to 7.0.0-alpha.3

6

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc