2017-07-11 03:43:53 -07:00
|
|
|
/**
|
2018-09-11 15:27:47 -07:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2017-07-11 03:43:53 -07:00
|
|
|
*
|
2018-02-16 18:24:55 -08:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2017-07-11 03:43:53 -07:00
|
|
|
*
|
2018-05-10 19:06:46 -07:00
|
|
|
* @format
|
2017-07-11 03:43:53 -07:00
|
|
|
* @polyfill
|
|
|
|
*/
|
|
|
|
|
2018-08-23 13:51:55 -07:00
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
2017-07-11 03:43:53 -07:00
|
|
|
|
2018-08-23 13:51:55 -07:00
|
|
|
if (typeof Object.assign !== 'function') {
|
|
|
|
Object.defineProperty(Object, 'assign', {
|
|
|
|
value: function assign(target, varArgs) {
|
|
|
|
'use strict';
|
|
|
|
if (target == null) {
|
|
|
|
throw new TypeError('Cannot convert undefined or null to object');
|
2017-07-11 03:43:53 -07:00
|
|
|
}
|
|
|
|
|
2018-08-23 13:51:55 -07:00
|
|
|
let to = Object(target);
|
2017-07-11 03:43:53 -07:00
|
|
|
|
2018-08-23 13:51:55 -07:00
|
|
|
for (let index = 1; index < arguments.length; index++) {
|
|
|
|
let nextSource = arguments[index];
|
|
|
|
|
|
|
|
if (nextSource != null) {
|
|
|
|
for (let nextKey in nextSource) {
|
|
|
|
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
|
|
|
to[nextKey] = nextSource[nextKey];
|
|
|
|
}
|
|
|
|
}
|
2017-07-11 03:43:53 -07:00
|
|
|
}
|
|
|
|
}
|
2018-08-23 13:51:55 -07:00
|
|
|
return to;
|
|
|
|
},
|
|
|
|
writable: true,
|
|
|
|
configurable: true,
|
|
|
|
});
|
|
|
|
}
|