18 lines
387 B
JavaScript
18 lines
387 B
JavaScript
|
|
/**
|
|
* 拓展对象
|
|
*/
|
|
exports.extend = function extend(target) {
|
|
var sources = Array.prototype.slice.call(arguments, 1);
|
|
|
|
for (var i = 0; i < sources.length; i += 1) {
|
|
var source = sources[i];
|
|
for (var key in source) {
|
|
if (source.hasOwnProperty(key)) {
|
|
target[key] = source[key];
|
|
}
|
|
}
|
|
}
|
|
|
|
return target;
|
|
}; |