https://github.com/vutran/conkat
😺 Merge arrays, objects, maps, and sets
https://github.com/vutran/conkat
array concat list maps merge object set util
Last synced: 12 months ago
JSON representation
😺 Merge arrays, objects, maps, and sets
- Host: GitHub
- URL: https://github.com/vutran/conkat
- Owner: vutran
- License: mit
- Created: 2018-01-26T02:24:03.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-04T16:14:13.000Z (over 7 years ago)
- Last Synced: 2025-02-07T01:47:38.689Z (over 1 year ago)
- Topics: array, concat, list, maps, merge, object, set, util
- Language: JavaScript
- Size: 97.7 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# conkat
> Merge arrays, objects, maps, and sets
## Install
```
$ npm i -S conkat
```
## Usage
### Merge Arrays
```js
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]
```
### Merge Objects
```js
const a = {
first_name: 'Vu',
}
const b = {
last_name: 'Tran',
}
console.log(conkat(a, b));
// -> { first_name: 'Vu', last_name: 'Tran' }
```
### Merge ES2015 Sets
```js
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' }
```
### Merge ES2015 Maps
```js
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 }
```
## License
MIT © [Vu Tran](https://github.com/vutran/conkat)