Skip to content

Commit

Permalink
Add example to spread README [skip ci] (babel#5227)
Browse files Browse the repository at this point in the history
  • Loading branch information
finkef authored and chitchu committed Jan 29, 2017
1 parent bbdf71f commit fb96d14
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions packages/babel-plugin-transform-es2015-spread/README.md
Expand Up @@ -2,6 +2,40 @@

> Compile ES2015 spread to ES5
## Example

**In**

```js
var a = ['a', 'b', 'c'];
var b = [...a, 'foo'];

var c = { foo: 'bar', baz: 42 };
var d = {...o, a: 2};
```

**Out**

```js
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
}

var a = [ 'a', 'b', 'c' ];
var b = [].concat(a, [ 'foo' ]);

var c = { foo: 'bar', baz: 42 };
var d = _extends({}, o, { a: 2 });
```

## Installation

```sh
Expand Down

0 comments on commit fb96d14

Please sign in to comment.