Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jfmengels/set-union
https://github.com/jfmengels/set-union
javascript set union
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/jfmengels/set-union
- Owner: jfmengels
- License: mit
- Created: 2017-02-09T09:20:42.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-09T09:22:32.000Z (almost 8 years ago)
- Last Synced: 2024-11-16T04:25:38.052Z (about 2 months ago)
- Topics: javascript, set, union
- Language: JavaScript
- Size: 2.93 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# set-union [![Build Status](https://travis-ci.org/jfmengels/set-union.svg?branch=master)](https://travis-ci.org/jfmengels/set-union)
> Creates a new Set from the union of two Sets or arrays
## Install
```
$ npm install --save set-union
```## Usage
```js
const union = require('set-union');union(new Set([1, 2, 3]), new Set([2, 3, 4]));
// => Set { 1, 2, 3, 4 }union([1, 2, 3], [2, 3, 4]);
// => Set { 1, 2, 3, 4 }
```## API
### union(set1, set2)
Will return a new Set containing the elements contained in both `set1` and `set2`. `set1` and `set2` must be Iterables, like arrays and `Set`s are.
## License
MIT © [Jeroen Engels](https://github.com/jfmengels)