object-assign
Advanced tools
Comparing version 1.0.0 to 2.0.0
13
index.js
@@ -12,3 +12,2 @@ 'use strict'; | ||
module.exports = Object.assign || function (target, source) { | ||
var pendingException; | ||
var from; | ||
@@ -23,17 +22,7 @@ var keys; | ||
for (var i = 0; i < keys.length; i++) { | ||
try { | ||
to[keys[i]] = from[keys[i]]; | ||
} catch (err) { | ||
if (pendingException === undefined) { | ||
pendingException = err; | ||
} | ||
} | ||
to[keys[i]] = from[keys[i]]; | ||
} | ||
} | ||
if (pendingException) { | ||
throw pendingException; | ||
} | ||
return to; | ||
}; |
{ | ||
"name": "object-assign", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "ES6 Object.assign() ponyfill", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -24,8 +24,12 @@ # object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign) | ||
// multiple sources | ||
objectAssign({foo: 0}, {bar: 1}, {baz: 3}); | ||
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, baz: 2} | ||
//=> {foo: 0, bar: 1} | ||
``` | ||
@@ -32,0 +36,0 @@ |
52
2321
20