# es6-set

> ECMAScript6 Set polyfill

Latest version **0.1.6** (published 2022-08-17) · ISC license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2022-08-17 |
| First published | 2013-10-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.12 |
| Dependencies | 6 |
| Unpacked size | 21.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 46 |
| Author | Mariusz Nowak |
| Maintainers | medikoo |
| Keywords | set, collection, es6, harmony, list, hash |

## Links

- npm: https://www.npmjs.com/package/es6-set
- Repository: https://github.com/medikoo/es6-set
- Homepage: https://github.com/medikoo/es6-set#readme
- Issues: https://github.com/medikoo/es6-set/issues
- npm.io page: https://npm.io/package/es6-set

## Dependencies (6)

- [d](https://npm.io/package/d.md) ^1.0.1
- [type](https://npm.io/package/type.md) ^2.7.2
- [es5-ext](https://npm.io/package/es5-ext.md) ^0.10.62
- [es6-symbol](https://npm.io/package/es6-symbol.md) ^3.1.3
- [es6-iterator](https://npm.io/package/es6-iterator.md) ~2.0.3
- [event-emitter](https://npm.io/package/event-emitter.md) ^0.3.5

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 0.1.6 (latest) — 2022-08-17
- 0.1.5 — 2017-03-16
- 0.1.4 — 2016-01-19
- 0.1.3 — 2015-11-18
- 0.1.2 — 2015-10-02
- 0.1.1 — 2014-10-07
- 0.1.0 — 2014-04-29
- 0.0.0 — 2013-10-12

## README

[![Build status][build-image]][build-url]
[![Tests coverage][cov-image]][cov-url]
[![npm version][npm-image]][npm-url]

# es6-set

## Set collection as specified in ECMAScript6

**Warning:  
v0.1 version does not ensure O(1) algorithm complexity (but O(n)). This shortcoming will be addressed in v1.0**

### Usage

If you want to make sure your environment implements `Set`, do:

```javascript
require("es6-set/implement");
```

If you'd like to use native version when it exists and fallback to polyfill if it doesn't, but without implementing `Set` on global scope, do:

```javascript
var Set = require("es6-set");
```

If you strictly want to use polyfill even if native `Set` exists, do:

```javascript
var Set = require("es6-set/polyfill");
```

### Installation

    $ npm install es6-set

To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/)

#### API

Best is to refer to [specification](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-set-objects). Still if you want quick look, follow examples:

```javascript
var Set = require("es6-set");

var set = new Set(["raz", "dwa", {}]);

set.size; // 3
set.has("raz"); // true
set.has("foo"); // false
set.add("foo"); // set
set.size; // 4
set.has("foo"); // true
set.has("dwa"); // true
set.delete("dwa"); // true
set.size; // 3

set.forEach(function (value) {
  // 'raz', {}, 'foo' iterated
});

// FF nightly only:
for (value of set) {
  // 'raz', {}, 'foo' iterated
}

var iterator = set.values();

iterator.next(); // { done: false, value: 'raz' }
iterator.next(); // { done: false, value: {} }
iterator.next(); // { done: false, value: 'foo' }
iterator.next(); // { done: true, value: undefined }

set.clear(); // undefined
set.size; // 0
```

## Tests

    $ npm test

## Security contact information

To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.

---

<div align="center">
	<b>
		<a href="https://tidelift.com/subscription/pkg/npm-es6-set?utm_source=npm-es6-set&utm_medium=referral&utm_campaign=readme">Get professional support for d with a Tidelift subscription</a>
	</b>
	<br>
	<sub>
		Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
	</sub>
</div>

[build-image]: https://github.com/medikoo/es6-set/workflows/Integrate/badge.svg
[build-url]: https://github.com/medikoo/es6-set/actions?query=workflow%3AIntegrate
[cov-image]: https://img.shields.io/codecov/c/github/medikoo/es6-set.svg
[cov-url]: https://codecov.io/gh/medikoo/es6-set
[npm-image]: https://img.shields.io/npm/v/es6-set.svg
[npm-url]: https://www.npmjs.com/package/es6-set

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