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).
Paul O’Shannessy committed
Aug 20, 2014 at 11:22 UTC
417678310c095c378e2ebd8c76e83a50ef21e7f9
1 file changed
+4
-5
src/vendor/polyfill/Object.es6.js
+4
-5
@@ -24,20 +24,20 @@ if (!Object.assign) {
24
if (target == null) {
25
throw new TypeError('Object.assign target cannot be null or undefined');
26
}
27
- var to = Object(target);
27
28
+ var to = Object(target);
29
var hasOwnProperty = Object.prototype.hasOwnProperty;
30
31
for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
32
var nextSource = arguments[nextIndex];
33
if (nextSource == null) {
34
- throw new TypeError('Object.assign source cannot be null or undefined');
34
+ continue;
35
}
36
37
var from = Object(nextSource);
38
39
- // We don't currently support accessors nor proxies. Therefore this copy
40
- // cannot throw. If we ever supported this then we must handle
39
+ // We don't currently support accessors nor proxies. Therefore this
40
+ // copy cannot throw. If we ever supported this then we must handle
41
// exceptions and side-effects.
42
43
for (var key in from) {
@@ -50,4 +50,3 @@ if (!Object.assign) {
50
return to;
51
};
52
}
53
-