https://github.com/maxmellon/array-set
create array as set from two arrays. like as intersection, union, and defference set.
https://github.com/maxmellon/array-set
Last synced: 11 months ago
JSON representation
create array as set from two arrays. like as intersection, union, and defference set.
- Host: GitHub
- URL: https://github.com/maxmellon/array-set
- Owner: MaxMEllon
- License: mit
- Created: 2020-10-12T10:03:18.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-12T10:04:34.000Z (over 5 years ago)
- Last Synced: 2025-04-07T14:43:25.798Z (about 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 47.9 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# array-set
> create array as set from two arrays. like as intersection, union, and defference set.
## Usage
```js
const { intersection, union, difference } = require("array-set");
union([3, 2, 3], [2, 3, 4]);
// => [3, 2, 4]
intersection([1, 2, 3], [3, 4, 5]);
// => [3]
difference([1, 2, 3, 4], [1, 2]);
// => [3, 4]
```
## API
### intersection: `(a: T[], b: T[]): T[]`
### union: `(a: T[], b: T[]): T[]`
### difference: `(a: T[], b: T[]): T[]`