UNPKG

539 BJavaScriptView Raw
1/**
2 * @name objectSpread
3 * @summary Concats all sources into the destination
4 */
5export function objectSpread(dest, ...sources) {
6 for (let i = 0, count = sources.length; i < count; i++) {
7 const src = sources[i];
8 if (src) {
9 if (typeof src.entries === 'function') {
10 for (const [key, value] of src.entries()) {
11 dest[key] = value;
12 }
13 }
14 else {
15 Object.assign(dest, src);
16 }
17 }
18 }
19 return dest;
20}