# @supercharge/set

> An Array-aligned Set class and the one JavaScript should have shipped

Latest version **2.2.1** (published 2022-01-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @supercharge/set
pnpm add @supercharge/set
yarn add @supercharge/set
bun add @supercharge/set
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.1 |
| Published | 2022-01-07 |
| First published | 2020-07-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 29.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Marcus Pöhls |
| Maintainers | marcuspoehls, peitek, celsiusf |
| Keywords | supercharge, superchargejs, set, nodejs |

## Links

- npm: https://www.npmjs.com/package/@supercharge/set
- Repository: https://github.com/supercharge/set
- Issues: https://github.com/supercharge/set/issues
- npm.io page: https://npm.io/package/@supercharge/set

## Recent versions

- 2.2.1 (latest) — 2022-01-07
- 2.2.0 — 2021-11-08
- 2.1.0 — 2021-08-28
- 2.0.0 — 2021-06-18
- 1.9.0 — 2021-05-13
- 1.8.0 — 2021-05-06
- 1.7.0 — 2021-05-03
- 1.6.0 — 2020-10-27
- 1.5.0 — 2020-10-17
- 1.4.0 — 2020-10-12
- 1.3.0 — 2020-08-31
- 1.2.0 — 2020-08-21
- 1.1.0 — 2020-08-05
- 1.0.0 — 2020-07-23

## README

<div align="center">
  <a href="https://superchargejs.com">
    <img width="471" style="max-width:100%;" src="https://superchargejs.com/images/supercharge-text.svg" />
  </a>
  <br/>
  <br/>
  <p>
    <h3>Set</h3>
  </p>
  <p>
    An Array-aligned <code>Set</code> class and the one JavaScript should have shipped
  </p>
  <br/>
  <p>
    <a href="#installation"><strong>Installation</strong></a> ·
    <a href="#resources"><strong>Docs</strong></a> ·
    <a href="#quick-usage-overview"><strong>Usage</strong></a>
  </p>
  <br/>
  <br/>
  <p>
    <a href="https://www.npmjs.com/package/@supercharge/set"><img src="https://img.shields.io/npm/v/@supercharge/set.svg" alt="Latest Version"></a>
    <a href="https://www.npmjs.com/package/@supercharge/set"><img src="https://img.shields.io/npm/dm/@supercharge/set.svg" alt="Monthly downloads"></a>
  </p>
  <p>
    <em>Follow <a href="http://twitter.com/marcuspoehls">@marcuspoehls</a> and <a href="http://twitter.com/superchargejs">@superchargejs</a> for updates!</em>
  </p>
</div>

---

## Introduction
The `@supercharge/set` package provides an improved [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) implementation.

- aligned with the `Array` class instead of `Map`
- provides helpful methods like `.map(callback)`, `.filter(callback)`, `.find(callback)`, `.isEmpty()`, and many more.
- compares values for `deep equality` and not `reference`
- it’s the `Set` class JavaScript should have shipped


## Installation

```
npm i @supercharge/set
```


## Resources

- [Documentation](https://superchargejs.com/docs/set)


## Quick Usage Overview
Using `@supercharge/set` is pretty straightforward. The package exports a `Set` class providing all methods to interact with the set.

```js
const Set = require('@supercharge/set')

const users = new Set()

users.isEmpty() // true

users
  .add({ id: 1, name: 'Marcus' })
  .add({ id: 2, name: 'Norman' })
  .add({ id: 3, name: 'Christian' })

users.isNotEmpty() // true

const usernames = users.map(user => {
  return user.name
})
// [ 'Marcus', 'Norman', 'Christian' ]

const marcus = users.find(user => {
  return user.name === 'Marcus'
})
// { id: 1, name: 'Marcus' }
```


## Contributing
Do you miss a function? We very much appreciate your contribution! Please send in a pull request 😊

1.  Create a fork
2.  Create your feature branch: `git checkout -b my-feature`
3.  Commit your changes: `git commit -am 'Add some feature'`
4.  Push to the branch: `git push origin my-new-feature`
5.  Submit a pull request 🚀


## License
MIT © [Supercharge](https://superchargejs.com)

---

> [superchargejs.com](https://superchargejs.com) &nbsp;&middot;&nbsp;
> GitHub [@supercharge](https://github.com/supercharge) &nbsp;&middot;&nbsp;
> Twitter [@superchargejs](https://twitter.com/superchargejs)

---
_Source: https://npm.io/package/@supercharge/set · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
