proposal-object-rest-spread

Rest/Spread Properties for ECMAScript

  • 所有者: tc39/proposal-object-rest-spread
  • 平台:
  • 許可證:
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Object Rest/Spread Properties for ECMAScript

ECMAScript 6 introduces rest elements for array destructuring assignment and spread elements for array literals.

This proposal introduces analogous rest properties for object destructuring assignment and spread properties for object literals.

Specification

Specification

Rest Properties

Rest properties collect the remaining own enumerable property keys that are not already picked off by the destructuring pattern. Those keys and their values are copied onto a new object.

let { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 };
x; // 1
y; // 2
z; // { a: 3, b: 4 }

Spread Properties

Spread properties in object initializers copies own enumerable properties from a provided object onto the newly created object.

let n = { x, y, ...z };
n; // { x: 1, y: 2, a: 3, b: 4 }

Transpilers

Babel

JSTransform

TypeScript

Status of this Proposal

It is a Stage 4 proposal for ECMAScript.

Known Issues

This proposal only iterates over own properties. See why this matters.

主要指標

概覽
名稱與所有者tc39/proposal-object-rest-spread
主編程語言HTML
編程語言HTML (語言數: 2)
平台
許可證
所有者活动
創建於2014-07-30 06:05:03
推送於2022-01-24 19:18:52
最后一次提交
發布數0
用户参与
星數1.5k
關注者數68
派生數85
提交數108
已啟用問題?
問題數46
打開的問題數14
拉請求數17
打開的拉請求數0
關閉的拉請求數7
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?