Skip to content

Commit

Permalink
Use Object.assign polyfill for update addon (facebook#9932)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored and nhunzaker committed Jun 13, 2017
1 parent 67a5639 commit e181660
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions addons/react-addons-update/index.js
Expand Up @@ -9,14 +9,15 @@

'use strict';

var _assign = require('object-assign');
var invariant = require('fbjs/lib/invariant');
var hasOwnProperty = {}.hasOwnProperty;

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;
}
Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit e181660

Please sign in to comment.