goldpankit
Version:
GoldPanKit是一款极速研发套件,可在套件中快速构建各类技术框架和项目。开源作者可发布自己的项目,并为其设定金额,实现开源项目的盈利。
18 lines (17 loc) • 388 B
JavaScript
module.exports = {
// 合并对象
merge (source, target, only=[]) {
for (const key in source) {
if (target[key] === undefined) {
continue
}
if (only.length > 0) {
if (only.find(field => field === key) == null) {
continue
}
}
target[key] = source[key] == null ? target[key] : source[key]
}
return this
}
}