UNPKG

736 BJavaScriptView Raw
1(function () {
2 if (typeof Object.assign != 'function') {
3 Object.assign = function(target, varArgs) { // .length of function is 2
4 'use strict';
5 if (target == null) { // TypeError if undefined or null
6 throw new TypeError('Cannot convert undefined or null to object');
7 }
8
9 var to = Object(target);
10
11 for (var index = 1; index < arguments.length; index++) {
12 var nextSource = arguments[index];
13
14 if (nextSource != null) { // Skip over if undefined or null
15 for (var nextKey in nextSource) {
16 // Avoid bugs when hasOwnProperty is shadowed
17 if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
18 to[nextKey] = nextSource[nextKey];
19 }
20 }
21 }
22 }
23 return to;
24 };
25 }
26})();