https://github.com/jlguenego/set
Javascript/Typescript - Operations on Set
https://github.com/jlguenego/set
equality include intersection set union
Last synced: about 2 months ago
JSON representation
Javascript/Typescript - Operations on Set
- Host: GitHub
- URL: https://github.com/jlguenego/set
- Owner: jlguenego
- Created: 2021-02-16T18:15:52.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-01T08:17:30.000Z (over 4 years ago)
- Last Synced: 2025-03-22T13:36:16.699Z (7 months ago)
- Topics: equality, include, intersection, set, union
- Language: TypeScript
- Homepage:
- Size: 1.51 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Set
Set utility in Javascript (and Typescript).
Set are native in Javascript (since ES6). But the supported operations are limited. No union, intersection, include, etc.
This library tries to provide all missing basic functions.This library covers the concept exposed in the 1972 book from Aho & Ullman, The Theory of Parsing, Translation, and Compiling.
## Install
```
npm i @jlguenego/set
```This library exposes both:
- **ES2015** module that can be tree-shaked by Webpack for Angular etc.
- **CommonJS** module for traditionnal node way.It is ready to use for both browsers and node app.
## Usage
```ts
const a = new Set([1, 2, 3]);
const b = new Set([3, 4, 5]);
const c = Sets.union(a, b);
const d = new Set([1, 2, 3, 4, 5]);
assert(Sets.areEquals(c, d));
const e = Sets.intersection(a, b);
const f = new Set([3]);
assert(Sets.areEquals(e, f));
// etc.
```## API
[See the typedoc documentation](./docs/api/modules.md)
## Examples
[See all examples in the test suite.](./test)
## Participating
Do not hesitate to bring your contribution to this project. Fork and Pull Request are welcome.
## Bibliography
- [Aho & Ullman, The Theory of Parsing, Translation, and Compiling](https://dl.acm.org/doi/book/10.5555/578789)
## License
ISC
## Author
Jean-Louis GUENEGO
```
```