object-assign

ES2015 Object.assign() ponyfill

  • 所有者: sindresorhus/object-assign
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

object-assign Build Status

ES2015 Object.assign() ponyfill

Use the built-in

Node.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari),
support Object.assign() :tada:. If you target only those environments, then by all
means, use Object.assign() instead of this package.

Install

$ npm install object-assign

Usage

const objectAssign = require('object-assign');

objectAssign({foo: 0}, {bar: 1});
//=> {foo: 0, bar: 1}

// multiple sources
objectAssign({foo: 0}, {bar: 1}, {baz: 2});
//=> {foo: 0, bar: 1, baz: 2}

// overwrites equal keys
objectAssign({foo: 0}, {foo: 1}, {foo: 2});
//=> {foo: 2}

// ignores null and undefined sources
objectAssign({foo: 0}, null, {bar: 1}, undefined);
//=> {foo: 0, bar: 1}

API

objectAssign(target, [source, ...])

Assigns enumerable own properties of source objects to the target object and returns the target object. Additional source objects will overwrite previous ones.

Resources


主要指標

概覽
名稱與所有者sindresorhus/object-assign
主編程語言JavaScript
編程語言JavaScript (語言數: 1)
平台
許可證MIT License
所有者活动
創建於2014-02-02 15:45:54
推送於2023-11-05 18:16:06
最后一次提交
發布數17
最新版本名稱v4.1.1 (發布於 2017-01-16 22:35:13)
第一版名稱0.1.0 (發布於 2014-02-02 16:47:53)
用户参与
星數0.9k
關注者數19
派生數72
提交數67
已啟用問題?
問題數0
打開的問題數0
拉請求數15
打開的拉請求數0
關閉的拉請求數16
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?