Use Object.assign polyfill for update addon (#9932)

This commit is contained in:
Dan Abramov
2017-06-12 19:46:08 +01:00
committed by GitHub
parent 41e135e270
commit 088d593b0b
+3 -2
View File
@@ -9,6 +9,7 @@
'use strict';
var _assign = require('object-assign');
var invariant = require('fbjs/lib/invariant');
var hasOwnProperty = {}.hasOwnProperty;
@@ -16,7 +17,7 @@ function shallowCopy(x) {
if (Array.isArray(x)) {
return x.concat();
} else if (x && typeof x === 'object') {
return Object.assign(new x.constructor(), x);
return _assign(new x.constructor(), x);
} else {
return x;
}
@@ -100,7 +101,7 @@ function update(value, spec) {
COMMAND_MERGE,
nextValue
);
Object.assign(nextValue, spec[COMMAND_MERGE]);
_assign(nextValue, spec[COMMAND_MERGE]);
}
if (hasOwnProperty.call(spec, COMMAND_PUSH)) {