# set-component

> Set container

Latest version **1.0.0** (published 2012-11-07) · 0 weekly downloads

## Install

```sh
npm install set-component
pnpm add set-component
yarn add set-component
bun add set-component
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2012-11-07 |
| First published | 2012-09-17 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | tjholowaychuk |
| Keywords | set |

## Links

- npm: https://www.npmjs.com/package/set-component
- npm.io page: https://npm.io/package/set-component

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2012-11-07
- 0.0.4 — 2012-10-17
- 0.0.3 — 2012-09-19
- 0.0.2 — 2012-09-19
- 0.0.1 — 2012-09-17

## README

# set

  Generic Set container

## Installation

```
$ component install component/set
```

## Example

```js
var Set = require('set');
var set = new Set;

set.add('foo');
set.add('foo');
set.add({ some: 'object' });
set.remove('foo');

set.values();
// => [{ some: 'object' }]
```

## Equality

  Set supports an `.equals(other)` method when present,
  for example you may then add two separate `User` instances
  that are identified as being the same via their name:

```js
User.prototype.equals = function(user){
  return this.name == user.name;
};
```

## API

### Set()

  Create a new `Set`.

### Set(values)

  Create a new `Set` with `values` array. Duplicates will be removed.

### Set#add(value)

  Add `value` to the set.

### Set#remove(value)

  Remove `value` from the set, returning __true__ when present,
  otherwise returning __false__.

### Set#has(value)

  Check if `value` is present.

### Set#values()

  Return an array of values.

  Aliased as `.toJSON()`.

### Set#each(fn)

  Iterate each member and invoke `fn(val)`.

### Set#size()

  Return the set size.

### Set#clear()

  Empty the set and return the old values array.

### Set#isEmpty()

  Check if the set is empty.

### Set#union(set)

  Perform a union with `set` and return a new `Set`.

### Set#intersect(set)

  Perform an intersection with `set` and return a new `Set`.

## License 

  MIT

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