Skip to content

docs: update on object spread syntax #1642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/fr/guide/mutations.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Puisqu'un état de store de Vuex est rendu réactif par Vue, lorsque nous mutons

- Utiliser `Vue.set(obj, 'newProp', 123)`, ou

- Remplacer cet objet par un nouvel objet. Par exemple, en utilisant [opérateur de décomposition](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Op%C3%A9rateurs/Op%C3%A9rateur_de_d%C3%A9composition) (stage-2), il est possible d'écrire :
- Remplacer cet objet par un nouvel objet. Par exemple, en utilisant [opérateur de décomposition](https://github.com/tc39/proposal-object-rest-spread), il est possible d'écrire :

``` js
state.obj = { ...state.obj, newProp: 123 }
Expand Down
2 changes: 1 addition & 1 deletion docs/fr/guide/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ computed: mapState([

### Opérateur de décomposition

Notez que `mapState` renvoie un objet. Comment l'utiliser en complément des autres propriétés calculées locales ? Normalement, il faudrait utiliser un outil pour fusionner les multiples objets en un seul afin de passer cet objet final à `computed`. Cependant avec l'[opérateur de décomposition](https://github.com/sebmarkbage/ecmascript-rest-spread) (qui est une proposition stage-4 ECMAScript), nous pouvons grandement simplifier la syntaxe :
Notez que `mapState` renvoie un objet. Comment l'utiliser en complément des autres propriétés calculées locales ? Normalement, il faudrait utiliser un outil pour fusionner les multiples objets en un seul afin de passer cet objet final à `computed`. Cependant avec l'[opérateur de décomposition](https://github.com/tc39/proposal-object-rest-spread), nous pouvons grandement simplifier la syntaxe :

``` js
computed: {
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/mutations.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Since a Vuex store's state is made reactive by Vue, when we mutate the state, Vu

- Use `Vue.set(obj, 'newProp', 123)`, or

- Replace that Object with a fresh one. For example, using the [object spread syntax](https://github.com/sebmarkbage/ecmascript-rest-spread) we can write it like this:
- Replace that Object with a fresh one. For example, using the [object spread syntax](https://github.com/tc39/proposal-object-rest-spread) we can write it like this:

``` js
state.obj = { ...state.obj, newProp: 123 }
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ computed: mapState([

### Object Spread Operator

Note that `mapState` returns an object. How do we use it in combination with other local computed properties? Normally, we'd have to use a utility to merge multiple objects into one so that we can pass the final object to `computed`. However with the [object spread operator](https://github.com/sebmarkbage/ecmascript-rest-spread) (which is a stage-4 ECMAScript proposal), we can greatly simplify the syntax:
Note that `mapState` returns an object. How do we use it in combination with other local computed properties? Normally, we'd have to use a utility to merge multiple objects into one so that we can pass the final object to `computed`. However with the [object spread operator](https://github.com/tc39/proposal-object-rest-spread), we can greatly simplify the syntax:

``` js
computed: {
Expand Down
2 changes: 1 addition & 1 deletion docs/ja/guide/mutations.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Vuex ストアの状態は Vue によってリアクティブになっている

- `Vue.set(obj, 'newProp', 123)` を使用する。あるいは

- 全く新しいオブジェクトで既存のオブジェクトを置き換える。例えば、[スプレッドシンタックス(object spread syntax)](https://github.com/sebmarkbage/ecmascript-rest-spread) を使用して、次のように書くことができます:
- 全く新しいオブジェクトで既存のオブジェクトを置き換える。例えば、[スプレッドシンタックス(object spread syntax)](https://github.com/tc39/proposal-object-rest-spread) を使用して、次のように書くことができます:

``` js
state.obj = { ...state.obj, newProp: 123 }
Expand Down
2 changes: 1 addition & 1 deletion docs/ja/guide/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ computed: mapState([

### オブジェクトスプレッド演算子

`mapState` はオブジェクトを返すことに注意しましょう。どうやって、他のローカル算出プロパティと組み合わせるのでしょうか? 通常、最終的にひとつのオブジェクトを `computed` に渡せるように、複数のオブジェクトをひとつにマージするユーティリティを使わなければいけません。しかし、[オブジェクトスプレッド演算子](https://github.com/sebmarkbage/ecmascript-rest-spread) (ECMAScript プロポーサルの state-4 です) で、シンタックスをかなり単純にできます:
`mapState` はオブジェクトを返すことに注意しましょう。どうやって、他のローカル算出プロパティと組み合わせるのでしょうか? 通常、最終的にひとつのオブジェクトを `computed` に渡せるように、複数のオブジェクトをひとつにマージするユーティリティを使わなければいけません。しかし、[オブジェクトスプレッド演算子](https://github.com/tc39/proposal-object-rest-spread)で、シンタックスをかなり単純にできます:

```js
computed: {
Expand Down
2 changes: 1 addition & 1 deletion docs/kr/guide/mutations.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Vuex 저장소의 상태는 Vue에 의해 반응하므로, 상태를 변경하

- `Vue.set(obj, 'newProp', 123)`을 사용하거나,

- 객체를 새로운 것으로 교체하십시오. 예를 들어, 3 단계 [객체 확산 문법](https://github.com/sebmarkbage/ecmascript-rest-spread)을 사용하면 다음과 같이 작성할 수 있습니다.
- 객체를 새로운 것으로 교체하십시오. 예를 들어, [객체 확산 문법](https://github.com/tc39/proposal-object-rest-spread)을 사용하면 다음과 같이 작성할 수 있습니다.

``` js
state.obj = { ...state.obj, newProp: 123 }
Expand Down
2 changes: 1 addition & 1 deletion docs/kr/guide/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ computed: mapState([

### 객체 전개 연산자 (Object Spread Operator)

`mapState`는 객체를 반환합니다. 다른 로컬 영역의 계산된 속성과 함께 사용하려면 어떻게 해야 하나요? 일반적으로, 최종 객체를 `computed`에 전달할 수 있도록 여러 객체를 하나로 병합하는 유틸리티를 사용해야합니다. 그러나 (3 단계 ECMAScript 스펙) [객체 전개 연산자 (Object Spread Operator)](https://github.com/sebmarkbage/ecmascript-rest-spread)을 사용하면 문법을 매우 단순화 할 수 있습니다.
`mapState`는 객체를 반환합니다. 다른 로컬 영역의 계산된 속성과 함께 사용하려면 어떻게 해야 하나요? 일반적으로, 최종 객체를 `computed`에 전달할 수 있도록 여러 객체를 하나로 병합하는 유틸리티를 사용해야합니다. 그러나 [객체 전개 연산자 (Object Spread Operator)](https://github.com/tc39/proposal-object-rest-spread)을 사용하면 문법을 매우 단순화 할 수 있습니다.

``` js
computed: {
Expand Down
2 changes: 1 addition & 1 deletion docs/ptbr/guide/mutations.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Como o estado de um _store_ Vuex é reativado pelo Vue, quando alteramos o estad

- Usar `Vue.set(obj, 'newProp', 123)`, ou

- Substitua esse objeto por um novo. Por exemplo, usando o _stage-3_ [object spread syntax](https://github.com/sebmarkbage/ecmascript-rest-spread) nós podemos escrevê-lo assim:
- Substitua esse objeto por um novo. Por exemplo, usando o [object spread syntax](https://github.com/tc39/proposal-object-rest-spread) nós podemos escrevê-lo assim:

``` js
state.obj = { ...state.obj, newProp: 123 }
Expand Down
2 changes: 1 addition & 1 deletion docs/ptbr/guide/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ computed: mapState([

### Objeto Spread Operator

Observe que _mapState_ retorna um objeto. Como usá-lo em combinação com outros dados computados locais? Normalmente, teríamos que usar um utilitário para fundir vários objetos em um para que possamos passar o objeto final para `computado`. No entanto, com o [Spread Operator](https://github.com/sebmarkbage/ecmascript-rest-spread) (que é uma proposta de ECMAScript em estágio 4), podemos simplificar muito a sintaxe:
Observe que _mapState_ retorna um objeto. Como usá-lo em combinação com outros dados computados locais? Normalmente, teríamos que usar um utilitário para fundir vários objetos em um para que possamos passar o objeto final para `computado`. No entanto, com o [Spread Operator](https://github.com/tc39/proposal-object-rest-spread), podemos simplificar muito a sintaxe:

``` js
computed: {
Expand Down
2 changes: 1 addition & 1 deletion docs/ru/guide/mutations.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ mutations: {

* Использовать `Vue.set(obj, 'newProp', 123)`, или

* Целиком заменить старый объект новым. Например, используя [синтаксис расширения объектов](https://github.com/sebmarkbage/ecmascript-rest-spread) можно написать так:
* Целиком заменить старый объект новым. Например, используя [синтаксис расширения объектов](https://github.com/tc39/proposal-object-rest-spread) можно написать так:

```js
state.obj = { ...state.obj, newProp: 123 };
Expand Down
2 changes: 1 addition & 1 deletion docs/ru/guide/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ computed: mapState([

### Оператор распространения объектов

Обратите внимание, `mapState` возвращает объект. Как же его использовать в сочетании с другими локальными вычисляемыми свойствами? Для этого обычно приходилось использовать вспомогательные утилиты для объединения нескольких объектов в один, который передавать в `computed`. Однако, с помощью [оператора распространения объектов](https://github.com/sebmarkbage/ecmascript-rest-spread) (предложение находится в статусе stage-4 ECMAScript) можно значительно упростить синтаксис:
Обратите внимание, `mapState` возвращает объект. Как же его использовать в сочетании с другими локальными вычисляемыми свойствами? Для этого обычно приходилось использовать вспомогательные утилиты для объединения нескольких объектов в один, который передавать в `computed`. Однако, с помощью [оператора распространения объектов](https://github.com/tc39/proposal-object-rest-spread) можно значительно упростить синтаксис:

```js
computed: {
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/guide/mutations.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ mutations: {

- 使用 `Vue.set(obj, 'newProp', 123)`, 或者

- 以新对象替换老对象。例如,利用 stage-3 的[对象展开运算符](https://github.com/sebmarkbage/ecmascript-rest-spread)我们可以这样写:
- 以新对象替换老对象。例如,利用[对象展开运算符](https://github.com/tc39/proposal-object-rest-spread)我们可以这样写:

``` js
state.obj = { ...state.obj, newProp: 123 }
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/guide/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ computed: mapState([

### 对象展开运算符

`mapState` 函数返回的是一个对象。我们如何将它与局部计算属性混合使用呢?通常,我们需要使用一个工具函数将多个对象合并为一个,以使我们可以将最终对象传给 `computed` 属性。但是自从有了[对象展开运算符](https://github.com/sebmarkbage/ecmascript-rest-spread)(现处于 ECMAScript 提案 stage-4 阶段),我们可以极大地简化写法:
`mapState` 函数返回的是一个对象。我们如何将它与局部计算属性混合使用呢?通常,我们需要使用一个工具函数将多个对象合并为一个,以使我们可以将最终对象传给 `computed` 属性。但是自从有了[对象展开运算符](https://github.com/tc39/proposal-object-rest-spread),我们可以极大地简化写法:

``` js
computed: {
Expand Down