Minor object-rest-spread README tweaks [skip ci]

This commit is contained in:
Brian Ng 2018-02-16 20:56:21 -06:00 committed by GitHub
parent 6cbc585cf4
commit 4d17a96d50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,7 +54,7 @@ require("@babel/core").transform("code", {
## Options ## Options
By default, this plugin will produce spec compliant code. The Babel's `objectSpread` helper will be used. By default, this plugin will produce spec compliant code by using Babel's `objectSpread` helper.
### `loose` ### `loose`
@ -62,7 +62,7 @@ By default, this plugin will produce spec compliant code. The Babel's `objectSpr
Enabling this option will use Babel's `extends` helper, which is basically the same as `Object.assign` (see `useBuiltIns` below to use it directly). Enabling this option will use Babel's `extends` helper, which is basically the same as `Object.assign` (see `useBuiltIns` below to use it directly).
:warning: Please take in mind that even if they're almost equivalent, there's an important difference between spread and `Object.assign`: to summarize, **spread defines new properties, while `Object.assign()` sets them**, so using this mode might produce unexpected results in some case. :warning: Please keep in mind that even if they're almost equivalent, there's an important difference between spread and `Object.assign`: **spread _defines_ new properties, while `Object.assign()` _sets_ them**, so using this mode might produce unexpected results in some cases.
For detailed information please check out [Spread VS. Object.assign](http://2ality.com/2016/10/rest-spread-properties.html#spreading-objects-versus-objectassign) and [Assigning VS. defining properties](http://exploringjs.com/es6/ch_oop-besides-classes.html#sec_assigning-vs-defining-properties). For detailed information please check out [Spread VS. Object.assign](http://2ality.com/2016/10/rest-spread-properties.html#spreading-objects-versus-objectassign) and [Assigning VS. defining properties](http://exploringjs.com/es6/ch_oop-besides-classes.html#sec_assigning-vs-defining-properties).