Update Object.assign polyfill

The spec changed to allow null & undefined sources without throwing.
Now our code depends on this new behavior. The only browser that
implements Object.assign has also updated its native implementation to
this behavior (Firefox Nightly).
This commit is contained in:
Paul O’Shannessy committed 2014-08-20 11:44:24 -07:00
1 parent 2058ad99be
commit 417678310c
1 file changed
+4 -5
+4 -5
View File
@@ -24,20 +24,20 @@ if (!Object.assign) {
if (target == null) {
throw new TypeError('Object.assign target cannot be null or undefined');
}
var to = Object(target);
var to = Object(target);
var hasOwnProperty = Object.prototype.hasOwnProperty;
for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
var nextSource = arguments[nextIndex];
if (nextSource == null) {
throw new TypeError('Object.assign source cannot be null or undefined');
continue;
}
var from = Object(nextSource);
// We don't currently support accessors nor proxies. Therefore this copy
// cannot throw. If we ever supported this then we must handle
// We don't currently support accessors nor proxies. Therefore this
// copy cannot throw. If we ever supported this then we must handle
// exceptions and side-effects.
for (var key in from) {
@@ -50,4 +50,3 @@ if (!Object.assign) {
return to;
};
}