Files
react/packages/shared/forks/object-assign.inline-umd.js
Sebastian Markbåge 3e94bce765 Enable prefer-const lint rules (#18451)
* Enable prefer-const rule

Stylistically I don't like this but Closure Compiler takes advantage of
this information.

* Auto-fix lints

* Manually fix the remaining callsites
2020-04-01 12:35:52 -07:00

32 lines
705 B
JavaScript

/**
* Copyright 2004-present Facebook. All Rights Reserved.
*/
const hasOwnProperty = Object.prototype.hasOwnProperty;
const _assign = function(to, from) {
for (const key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
};
export default Object.assign ||
function(target, sources) {
if (target == null) {
throw new TypeError('Object.assign target cannot be null or undefined');
}
const to = Object(target);
for (let nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
const nextSource = arguments[nextIndex];
if (nextSource != null) {
_assign(to, Object(nextSource));
}
}
return to;
};