Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rawad663/js-set-manipulation
Functions giving you easier control over set manipulations (Intersection, Union, Difference, etc...)
https://github.com/rawad663/js-set-manipulation
intersection javascript npm-package open-source sets union
Last synced: 27 days ago
JSON representation
Functions giving you easier control over set manipulations (Intersection, Union, Difference, etc...)
- Host: GitHub
- URL: https://github.com/rawad663/js-set-manipulation
- Owner: rawad663
- License: mit
- Created: 2019-04-15T22:44:59.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-04-22T13:11:11.000Z (over 5 years ago)
- Last Synced: 2024-11-06T03:51:01.619Z (about 2 months ago)
- Topics: intersection, javascript, npm-package, open-source, sets, union
- Language: JavaScript
- Size: 81.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Welcome to js-set-manipulation
Functions giving you easier control over set
manipulations (Intersection, Union, Difference, etc...)## Getting Started
First, we need to install the package with npm:`npm install --save js-set-manipulation`
We can now start using the package!
``` javascript
const { set } = require('js-set-manipulation');
const sets = [
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ],
[ 2, 4, 6, 8, 10, 12 ],
[ 1, 2, 4, 8, 16, 32, 64 ]
];/**
* This is equivalent to:
*
* console.log(set.union(set1, set2, set3));
*/
console.log(set.union(...sets)); // [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 16, 32, 64 ]
console.log(set.intersection(...sets)); // [ 2, 4, 8 ]
console.log(set.difference(set1, [ set2, set3 ])); // [ 3, 5, 7, 9 ]
```The following functions are provided so far:
| Module | Function | Input | Output |
| ------------- |:------------------:|:-------------------------------:| ------:|
| set | union | (Array, (Array, (Array, ...))) | Array |
| | intersection | (Array, (Array, (Array, ...))) | Array |
| | difference | (Array, [ Array, Array, ... ]) | Array |## Contributing to the project
Please check out [the contribution page](.github/CONTRIBUTING.md) to learn how to contribute to the project.