24 lines
452 B
JavaScript
24 lines
452 B
JavaScript
|
var hasKeys = require("./has-keys")
|
||
|
|
||
|
module.exports = extend
|
||
|
|
||
|
function extend(target) {
|
||
|
var sources = [].slice.call(arguments, 1)
|
||
|
|
||
|
for (var i = 0; i < sources.length; i++) {
|
||
|
var source = sources[i]
|
||
|
|
||
|
if (!hasKeys(source)) {
|
||
|
continue
|
||
|
}
|
||
|
|
||
|
for (var key in source) {
|
||
|
if (source.hasOwnProperty(key)) {
|
||
|
target[key] = source[key]
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return target
|
||
|
}
|