goliatone / gextend

Simple Object extend helper module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Optionally handle merging maps/sets

goliatone opened this issue · comments

Same as with #7 being able to handle arrays, we should be able to merge maps/sets.
Note that Object.assign would you overwrite the property.

let source = new Set(...);
let target = new Set(...);

source.forEach(target.add, source);
let source = new Map(...);
let target = new Map(...);

source.forEach((value, key) => target.set(key, value));