mirror of
https://github.com/facebook/react.git
synced 2026-02-26 03:04:59 +00:00
* 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
32 lines
705 B
JavaScript
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;
|
|
};
|