object-assign

ES2015 Object.assign() ponyfill

  • Owner: sindresorhus/object-assign
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

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


Main metrics

Overview
Name With Ownersindresorhus/object-assign
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 1)
Platform
License:MIT License
所有者活动
Created At2014-02-02 15:45:54
Pushed At2023-11-05 18:16:06
Last Commit At
Release Count17
Last Release Namev4.1.1 (Posted on 2017-01-16 22:35:13)
First Release Name0.1.0 (Posted on 2014-02-02 16:47:53)
用户参与
Stargazers Count0.9k
Watchers Count19
Fork Count82
Commits Count67
Has Issues Enabled
Issues Count0
Issue Open Count0
Pull Requests Count15
Pull Requests Open Count0
Pull Requests Close Count16
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private