object-assign-polyfill2
v1.0.0
Published
ES5 compatible Polyfill for Object.assign()
Downloads
3
Maintainers
Readme
Object.assign() polyfill
Provides a polyfill for Object.assign() to all Browsers supporting ES5. Note: This polyfill doesn't support symbol properties, since ES5 doesn't have symbols anyway
Description
Syntax: Object.assign(target, ...sources) The Object.assign() method is used to copy the values of all enumerable own properties from one or more source objects to a target object. It will return the target object.
Installation
$ npm install object-assign-polyfill --save
Import
// CommonJS
require('object-assign-polyfill');
// ES6 Modules
import 'object-assign-polyfill';
Usage
var obj1 = {
a: 1,
b: 'Hello'
};
var obj2 = {
a: 3,
c: 'World'
};
var obj3 = Object.assign({}, obj1, obj2);
// obj3 => { a: 3, b: 'Hello', c: 'World' }