Merge arrays, objects, maps, and sets
$ npm i -S conkat
import merge from 'conkat';
const a = [1, 2, 3];
const b = [4, 5, 6];
console.log(conkat(a, b));
// -> [1, 2, 3, 4, 5, 6]
const a = {
first_name: 'Vu',
}
const b = {
last_name: 'Tran',
}
console.log(conkat(a, b));
// -> { first_name: 'Vu', last_name: 'Tran' }
const a = new Set();
a.add('foo');
a.add('bar');
const b = new Set();
b.add('baz');
b.add('qux');
console.log(conkat(a, b));
// -> Set { 'foo', 'bar', 'baz', 'qux' }
const a = new Map();
a.set('one', 1);
a.set('two', 2);
const b = new Map();
a.set('three', 3);
console.log(conkat(a, b));
// -> Map { 'one' => 1, 'two' => 2, 'three' => 3 }
MIT ยฉ Vu Tran