mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
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:
1 parent
2058ad99be
commit
417678310c
1 file changed
+4
-5
Vendored
+4
-5
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user