1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | export default function(target, ...sources) { for (let i = 0; i < sources.length; i++) { let source = sources[i] || {}; for (let prop in source) { if (source.hasOwnProperty(prop)) { let value = source[prop]; if (value !== undefined) { target[prop] = value; } } } } return target; }; |