mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
484 B
27 lines
484 B
10 years ago
|
'use strict';
|
||
|
|
||
|
function ToObject(val) {
|
||
|
if (val == null) {
|
||
|
throw new TypeError('Object.assign cannot be called with null or undefined');
|
||
|
}
|
||
|
|
||
|
return Object(val);
|
||
|
}
|
||
|
|
||
|
module.exports = Object.assign || function (target, source) {
|
||
|
var from;
|
||
|
var keys;
|
||
|
var to = ToObject(target);
|
||
|
|
||
|
for (var s = 1; s < arguments.length; s++) {
|
||
|
from = arguments[s];
|
||
|
keys = Object.keys(Object(from));
|
||
|
|
||
|
for (var i = 0; i < keys.length; i++) {
|
||
|
to[keys[i]] = from[keys[i]];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return to;
|
||
|
};
|