# collections-x

> ES6 collections fallback library: Map and Set.

Latest version **3.1.2** (published 2019-08-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install collections-x
pnpm add collections-x
yarn add collections-x
bun add collections-x
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.2 |
| Published | 2019-08-28 |
| First published | 2015-11-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=8.11.4 |
| Dependencies | 28 |
| Unpacked size | 982 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Graham Fairweather |
| Maintainers | xotic750 |
| Keywords | es6, Map, Set, library, javascript, nodejs, browser |

## Links

- npm: https://www.npmjs.com/package/collections-x
- Repository: https://github.com/Xotic750/collections-x
- Issues: https://github.com/Xotic750/collections-x/issues
- npm.io page: https://npm.io/package/collections-x

## Dependencies (28)

- [is-map-x](https://npm.io/package/is-map-x.md) ^2.1.2
- [is-set-x](https://npm.io/package/is-set-x.md) ^2.1.2
- [attempt-x](https://npm.io/package/attempt-x.md) ^2.1.2
- [is-string](https://npm.io/package/is-string.md) ^1.0.4
- [index-of-x](https://npm.io/package/index-of-x.md) ^3.1.2
- [is-array-x](https://npm.io/package/is-array-x.md) ^2.1.2
- [array-some-x](https://npm.io/package/array-some-x.md) ^3.1.2
- [to-boolean-x](https://npm.io/package/to-boolean-x.md) ^2.1.1
- [big-counter-x](https://npm.io/package/big-counter-x.md) ^4.1.2
- [is-function-x](https://npm.io/package/is-function-x.md) ^4.1.2
- [simple-call-x](https://npm.io/package/simple-call-x.md) ^1.0.3
- [is-primitive-x](https://npm.io/package/is-primitive-x.md) ^1.0.1
- [is-array-like-x](https://npm.io/package/is-array-like-x.md) ^2.1.2
- [object-create-x](https://npm.io/package/object-create-x.md) ^3.1.2
- [array-for-each-x](https://npm.io/package/array-for-each-x.md) ^3.1.2
- [is-object-like-x](https://npm.io/package/is-object-like-x.md) ^2.1.2
- [symbol-species-x](https://npm.io/package/symbol-species-x.md) ^1.1.2
- [is-boolean-object](https://npm.io/package/is-boolean-object.md) ^1.0.0
- [rename-function-x](https://npm.io/package/rename-function-x.md) ^1.1.2
- [symbol-iterator-x](https://npm.io/package/symbol-iterator-x.md) ^1.1.2
- [assert-is-object-x](https://npm.io/package/assert-is-object-x.md) ^3.1.2
- [get-prototype-of-x](https://npm.io/package/get-prototype-of-x.md) ^2.1.2
- [has-own-property-x](https://npm.io/package/has-own-property-x.md) ^4.1.2
- [simple-methodize-x](https://npm.io/package/simple-methodize-x.md) ^1.0.4
- [is-surrogate-pair-x](https://npm.io/package/is-surrogate-pair-x.md) ^3.1.2
- [assert-is-function-x](https://npm.io/package/assert-is-function-x.md) ^3.1.2
- [object-define-property-x](https://npm.io/package/object-define-property-x.md) ^5.1.2
- [object-define-properties-x](https://npm.io/package/object-define-properties-x.md) ^5.1.2

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 3.1.2 (latest) — 2019-08-28
- 3.1.1 — 2019-08-20
- 3.1.0 — 2019-08-14
- 3.0.18 — 2019-08-05
- 3.0.17 — 2019-08-05
- 3.0.16 — 2019-08-05
- 3.0.15 — 2019-08-05
- 3.0.14 — 2019-08-05
- 3.0.13 — 2019-07-31
- 3.0.12 — 2019-07-27
- 3.0.11 — 2019-07-27
- 3.0.10 — 2019-07-26
- 3.0.9 — 2019-07-25
- 3.0.8 — 2019-07-24
- 3.0.7 — 2019-07-24
- … 30 more at https://npm.io/package/collections-x/versions

## README

<a
  href="https://travis-ci.org/Xotic750/collections-x"
  title="Travis status">
<img
  src="https://travis-ci.org/Xotic750/collections-x.svg?branch=master"
  alt="Travis status" height="18">
</a>
<a
  href="https://david-dm.org/Xotic750/collections-x"
  title="Dependency status">
<img src="https://david-dm.org/Xotic750/collections-x/status.svg"
  alt="Dependency status" height="18"/>
</a>
<a
  href="https://david-dm.org/Xotic750/collections-x?type=dev"
  title="devDependency status">
<img src="https://david-dm.org/Xotic750/collections-x/dev-status.svg"
  alt="devDependency status" height="18"/>
</a>
<a
  href="https://badge.fury.io/js/collections-x"
  title="npm version">
<img src="https://badge.fury.io/js/collections-x.svg"
  alt="npm version" height="18">
</a>
<a
  href="https://www.jsdelivr.com/package/npm/collections-x"
  title="jsDelivr hits">
<img src="https://data.jsdelivr.com/v1/package/npm/collections-x/badge?style=rounded"
  alt="jsDelivr hits" height="18">
</a>
<a
  href="https://bettercodehub.com/results/Xotic750/collections-x"
  title="bettercodehub score">
<img src="https://bettercodehub.com/edge/badge/Xotic750/collections-x?branch=master"
  alt="bettercodehub score" height="18">
</a>
<a
  href="https://coveralls.io/github/Xotic750/collections-x?branch=master"
  title="Coverage Status">
<img src="https://coveralls.io/repos/github/Xotic750/collections-x/badge.svg?branch=master"
  alt="Coverage Status" height="18">
</a>

<a name="module_collections-x"></a>

## collections-x

ES6 collections fallback library: Map and Set.

- [collections-x](#module_collections-x)
  - [`.isMap`](#module_collections-x.isMap) ⇒ <code>boolean</code>
  - [`.isSet`](#module_collections-x.isSet) ⇒ <code>boolean</code>
  - [`.MapConstructor`](#module_collections-x.MapConstructor)
    - [`.clear`](#module_collections-x.MapConstructor+clear) ⇒ <code>Object</code>
    - [`.delete`](#module_collections-x.MapConstructor+delete) ⇒ <code>boolean</code>
    - [`.entries`](#module_collections-x.MapConstructor+entries) ⇒ <code>Object</code>
    - [`.forEach`](#module_collections-x.MapConstructor+forEach) ⇒ <code>Object</code>
    - [`.get`](#module_collections-x.MapConstructor+get) ⇒ <code>\*</code>
    - [`.keys`](#module_collections-x.MapConstructor+keys) ⇒ <code>Object</code>
    - [`.set`](#module_collections-x.MapConstructor+set) ⇒ <code>Object</code>
    - [`.size`](#module_collections-x.MapConstructor+size) : <code>number</code>
    - [`.values`](#module_collections-x.MapConstructor+values) ⇒ <code>Object</code>
    - [`.has(key)`](#module_collections-x.MapConstructor+has) ⇒ <code>boolean</code>
    - [`.symIt()`](#module_collections-x.MapConstructor+symIt) ⇒ <code>Object</code>
  - [`.SetConstructor`](#module_collections-x.SetConstructor)
    - [`.add`](#module_collections-x.SetConstructor+add) ⇒ <code>Object</code>
    - [`.clear`](#module_collections-x.SetConstructor+clear) ⇒ <code>Object</code>
    - [`.delete`](#module_collections-x.SetConstructor+delete) ⇒ <code>boolean</code>
    - [`.forEach`](#module_collections-x.SetConstructor+forEach) ⇒ <code>Object</code>
    - [`.size`](#module_collections-x.SetConstructor+size) : <code>number</code>
    - [`.entries()`](#module_collections-x.SetConstructor+entries) ⇒ <code>Object</code>
    - [`.has(value)`](#module_collections-x.SetConstructor+has) ⇒ <code>boolean</code>
    - [`.keys()`](#module_collections-x.SetConstructor+keys) ⇒ <code>Object</code>
    - [`.values()`](#module_collections-x.SetConstructor+values) ⇒ <code>Object</code>
    - [`.symIt()`](#module_collections-x.SetConstructor+symIt) ⇒ <code>Object</code>
  - [`.symIt`](#module_collections-x.symIt)

<a name="module_collections-x.isMap"></a>

### `collections-x.isMap` ⇒ <code>boolean</code>

Determine if an `object` is a `Map`.

**Kind**: static property of [<code>collections-x</code>](#module_collections-x)  
**Returns**: <code>boolean</code> - `true` if the `object` is a `Map`,
else `false`.

| Param  | Type            | Description         |
| ------ | --------------- | ------------------- |
| object | <code>\*</code> | The object to test. |

**Example**

```js
import {isMap} from 'collections-x';

const m = new MapConstructor();

console.log(isMap([])); // false
console.log(isMap(true)); // false
console.log(isMap(m)); // true
```

<a name="module_collections-x.isSet"></a>

### `collections-x.isSet` ⇒ <code>boolean</code>

Determine if an `object` is a `Set`.

**Kind**: static property of [<code>collections-x</code>](#module_collections-x)  
**Returns**: <code>boolean</code> - `true` if the `object` is a `Set`,
else `false`.

| Param  | Type            | Description         |
| ------ | --------------- | ------------------- |
| object | <code>\*</code> | The object to test. |

**Example**

```js
import {isSet} from 'collections-x';

const s = new SetConstructor();

console.log(isSet([])); // false
console.log(isSet(true)); // false
console.log(isSet(s)); // true
```

<a name="module_collections-x.MapConstructor"></a>

### `collections-x.MapConstructor`

**Kind**: static property of [<code>collections-x</code>](#module_collections-x)

- [`.MapConstructor`](#module_collections-x.MapConstructor)
  - [`.clear`](#module_collections-x.MapConstructor+clear) ⇒ <code>Object</code>
  - [`.delete`](#module_collections-x.MapConstructor+delete) ⇒ <code>boolean</code>
  - [`.entries`](#module_collections-x.MapConstructor+entries) ⇒ <code>Object</code>
  - [`.forEach`](#module_collections-x.MapConstructor+forEach) ⇒ <code>Object</code>
  - [`.get`](#module_collections-x.MapConstructor+get) ⇒ <code>\*</code>
  - [`.keys`](#module_collections-x.MapConstructor+keys) ⇒ <code>Object</code>
  - [`.set`](#module_collections-x.MapConstructor+set) ⇒ <code>Object</code>
  - [`.size`](#module_collections-x.MapConstructor+size) : <code>number</code>
  - [`.values`](#module_collections-x.MapConstructor+values) ⇒ <code>Object</code>
  - [`.has(key)`](#module_collections-x.MapConstructor+has) ⇒ <code>boolean</code>
  - [`.symIt()`](#module_collections-x.MapConstructor+symIt) ⇒ <code>Object</code>

<a name="module_collections-x.MapConstructor+clear"></a>

#### `map.clear` ⇒ <code>Object</code>

The clear() method removes all elements from a Map object.

**Kind**: instance property of [<code>Map</code>](#module_collections-x.MapConstructor)  
**Returns**: <code>Object</code> - The Map object.  
**Example**

```js
import {MapConstructor} from 'collections-x';

const myMap = new MapConstructor();
myMap.set('bar', 'baz');
myMap.set(1, 'foo');

console.log(myMap.size); // 2
console.log(myMap.has('bar')); // true

myMap.clear();

console.log(myMap.size); // 0
console.log(myMap.has('bar')); // false
```

<a name="module_collections-x.MapConstructor+delete"></a>

#### `map.delete` ⇒ <code>boolean</code>

The delete() method removes the specified element from a Map object.

**Kind**: instance property of [<code>Map</code>](#module_collections-x.MapConstructor)  
**Returns**: <code>boolean</code> - Returns true if an element in the Map object has been
removed successfully.

| Param | Type            | Description                                           |
| ----- | --------------- | ----------------------------------------------------- |
| key   | <code>\*</code> | The key of the element to remove from the Map object. |

**Example**

```js
import {MapConstructor} from 'collections-x';

const myMap = new MapConstructor();
myMap.set('bar', 'foo');

myMap.delete('bar'); // Returns true. Successfully removed.
myMap.has('bar'); // Returns false.
// The "bar" element is no longer present.
```

<a name="module_collections-x.MapConstructor+entries"></a>

#### `map.entries` ⇒ <code>Object</code>

The entries() method returns a new Iterator object that contains the
[key, value] pairs for each element in the Map object in insertion order.

**Kind**: instance property of [<code>Map</code>](#module_collections-x.MapConstructor)  
**Returns**: <code>Object</code> - A new Iterator object.  
**Example**

```js
import {MapConstructor} from 'collections-x';
const myMap = new MapConstructor();
myMap.set('0', 'foo');
myMap.set(1, 'bar');
myMap.set({}, 'baz');

const mapIter = myMap.entries();

console.log(mapIter.next().value); // ["0", "foo"]
console.log(mapIter.next().value); // [1, "bar"]
console.log(mapIter.next().value); // [Object, "baz"]
```

<a name="module_collections-x.MapConstructor+forEach"></a>

#### `map.forEach` ⇒ <code>Object</code>

The forEach() method executes a provided function once per each
key/value pair in the Map object, in insertion order.

**Kind**: instance property of [<code>Map</code>](#module_collections-x.MapConstructor)  
**Returns**: <code>Object</code> - The Map object.

| Param     | Type                  | Description                                   |
| --------- | --------------------- | --------------------------------------------- |
| callback  | <code>function</code> | Function to execute for each element.         |
| [thisArg] | <code>\*</code>       | Value to use as this when executing callback. |

**Example**

```js
import {MapConstructor} from 'collections-x';

function logElements(value, key, map) {
  console.log('m[' + key + '] = ' + value);
}

const myMap = new MapConstructor([['foo', 3], ['bar', {}], ['baz', undefined]]);
myMap.forEach(logElements);
// logs:
// "m[foo] = 3"
// "m[bar] = [object Object]"
// "m[baz] = undefined"
```

<a name="module_collections-x.MapConstructor+get"></a>

#### `map.get` ⇒ <code>\*</code>

The get() method returns a specified element from a Map object.

**Kind**: instance property of [<code>Map</code>](#module_collections-x.MapConstructor)  
**Returns**: <code>\*</code> - Returns the element associated with the specified key or
undefined if the key can't be found in the Map object.

| Param | Type            | Description                                           |
| ----- | --------------- | ----------------------------------------------------- |
| key   | <code>\*</code> | The key of the element to return from the Map object. |

**Example**

```js
import {MapConstructor} from 'collections-x';

const myMap = new MapConstructor();
myMap.set('bar', 'foo');

myMap.get('bar'); // Returns "foo".
myMap.get('baz'); // Returns undefined.
```

<a name="module_collections-x.MapConstructor+keys"></a>

#### `map.keys` ⇒ <code>Object</code>

The keys() method returns a new Iterator object that contains the keys
for each element in the Map object in insertion order.

**Kind**: instance property of [<code>Map</code>](#module_collections-x.MapConstructor)  
**Returns**: <code>Object</code> - A new Iterator object.  
**Example**

```js
import {MapConstructor} from 'collections-x';

const myMap = new MapConstructor();
myMap.set('0', 'foo');
myMap.set(1, 'bar');
myMap.set({}, 'baz');

const mapIter = myMap.keys();

console.log(mapIter.next().value); // "0"
console.log(mapIter.next().value); // 1
console.log(mapIter.next().value); // Object
```

<a name="module_collections-x.MapConstructor+set"></a>

#### `map.set` ⇒ <code>Object</code>

The set() method adds a new element with a specified key and value to
a Map object.

**Kind**: instance property of [<code>Map</code>](#module_collections-x.MapConstructor)  
**Returns**: <code>Object</code> - The Map object.

| Param | Type            | Description                                        |
| ----- | --------------- | -------------------------------------------------- |
| key   | <code>\*</code> | The key of the element to add to the Map object.   |
| value | <code>\*</code> | The value of the element to add to the Map object. |

**Example**

```js
import {MapConstructor} from 'collections-x';

const myMap = new MapConstructor();

// Add new elements to the map
myMap.set('bar', 'foo');
myMap.set(1, 'foobar');

// Update an element in the map
myMap.set('bar', 'fuuu');
```

<a name="module_collections-x.MapConstructor+size"></a>

#### `map.size` : <code>number</code>

The value of size is an integer representing how many entries the Map
object has.

**Kind**: instance property of [<code>Map</code>](#module_collections-x.MapConstructor)  
**Example**

```js
import {MapConstructor} from 'collections-x';

const myMap = new MapConstructor();
myMap.set(1, true);
myMap.set(5, false);
myMap.set('some text', 1);

console.log(myMap.size); // 3
```

<a name="module_collections-x.MapConstructor+values"></a>

#### `map.values` ⇒ <code>Object</code>

The values() method returns a new Iterator object that contains the
values for each element in the Map object in insertion order.

**Kind**: instance property of [<code>Map</code>](#module_collections-x.MapConstructor)  
**Returns**: <code>Object</code> - A new Iterator object.  
**Example**

```js
import {MapConstructor} from 'collections-x';

const myMap = new MapConstructor();
myMap.set('0', 'foo');
myMap.set(1, 'bar');
myMap.set({}, 'baz');

const mapIter = myMap.values();

console.log(mapIter.next().value); // "foo"
console.log(mapIter.next().value); // "bar"
console.log(mapIter.next().value); // "baz"
```

<a name="module_collections-x.MapConstructor+has"></a>

#### `map.has(key)` ⇒ <code>boolean</code>

The has() method returns a boolean indicating whether an element with
the specified key exists or not.

**Kind**: instance method of [<code>Map</code>](#module_collections-x.MapConstructor)  
**Returns**: <code>boolean</code> - Returns true if an element with the specified key
exists in the Map object; otherwise false.

| Param | Type            | Description                                                    |
| ----- | --------------- | -------------------------------------------------------------- |
| key   | <code>\*</code> | The key of the element to test for presence in the Map object. |

**Example**

```js
import {MapConstructor} from 'collections-x';

const myMap = new MapConstructor();
myMap.set('bar', 'foo');

myMap.has('bar'); // returns true
myMap.has('baz'); // returns false
```

<a name="module_collections-x.MapConstructor+symIt"></a>

#### `map.symIt()` ⇒ <code>Object</code>

The initial value of the @@iterator property is the same function object
as the initial value of the entries property.

**Kind**: instance method of [<code>Map</code>](#module_collections-x.MapConstructor)  
**Returns**: <code>Object</code> - A new Iterator object.  
**Example**

```js
import {MapConstructor, symIt} from 'collections-x';

const myMap = new MapConstructor();
myMap.set('0', 'foo');
myMap.set(1, 'bar');
myMap.set({}, 'baz');

var mapIter = myMap[symIt]();

console.log(mapIter.next().value); // ["0", "foo"]
console.log(mapIter.next().value); // [1, "bar"]
console.log(mapIter.next().value); // [Object, "baz"]
```

<a name="module_collections-x.SetConstructor"></a>

### `collections-x.SetConstructor`

**Kind**: static property of [<code>collections-x</code>](#module_collections-x)

- [`.SetConstructor`](#module_collections-x.SetConstructor)
  - [`.add`](#module_collections-x.SetConstructor+add) ⇒ <code>Object</code>
  - [`.clear`](#module_collections-x.SetConstructor+clear) ⇒ <code>Object</code>
  - [`.delete`](#module_collections-x.SetConstructor+delete) ⇒ <code>boolean</code>
  - [`.forEach`](#module_collections-x.SetConstructor+forEach) ⇒ <code>Object</code>
  - [`.size`](#module_collections-x.SetConstructor+size) : <code>number</code>
  - [`.entries()`](#module_collections-x.SetConstructor+entries) ⇒ <code>Object</code>
  - [`.has(value)`](#module_collections-x.SetConstructor+has) ⇒ <code>boolean</code>
  - [`.keys()`](#module_collections-x.SetConstructor+keys) ⇒ <code>Object</code>
  - [`.values()`](#module_collections-x.SetConstructor+values) ⇒ <code>Object</code>
  - [`.symIt()`](#module_collections-x.SetConstructor+symIt) ⇒ <code>Object</code>

<a name="module_collections-x.SetConstructor+add"></a>

#### `set.add` ⇒ <code>Object</code>

The add() method appends a new element with a specified value to the end
of a Set object.

**Kind**: instance property of [<code>Set</code>](#module_collections-x.SetConstructor)  
**Returns**: <code>Object</code> - The Set object.

| Param | Type            | Description                                                  |
| ----- | --------------- | ------------------------------------------------------------ |
| value | <code>\*</code> | Required. The value of the element to add to the Set object. |

**Example**

```js
import {SetConstructor} from 'collections-x';

const mySet = new SetConstructor();

mySet.add(1);
mySet.add(5).add('some text'); // chainable

console.log(mySet);
// Set [1, 5, "some text"]
```

<a name="module_collections-x.SetConstructor+clear"></a>

#### `set.clear` ⇒ <code>Object</code>

The clear() method removes all elements from a Set object.

**Kind**: instance property of [<code>Set</code>](#module_collections-x.SetConstructor)  
**Returns**: <code>Object</code> - The Set object.  
**Example**

```js
import {SetConstructor} from 'collections-x';

const mySet = new SetConstructor();
mySet.add(1);
mySet.add('foo');

console.log(mySet.size); // 2
mySet.has('foo'); // true

mySet.clear();

console.log(mySet.size); // 0
mySet.has('bar'); // false
```

<a name="module_collections-x.SetConstructor+delete"></a>

#### `set.delete` ⇒ <code>boolean</code>

The delete() method removes the specified element from a Set object.

**Kind**: instance property of [<code>Set</code>](#module_collections-x.SetConstructor)  
**Returns**: <code>boolean</code> - Returns true if an element in the Set object has been
removed successfully; otherwise false.

| Param | Type            | Description                                             |
| ----- | --------------- | ------------------------------------------------------- |
| value | <code>\*</code> | The value of the element to remove from the Set object. |

**Example**

```js
import {SetConstructor} from 'collections-x';

const mySet = new SetConstructor();
mySet.add('foo');

mySet.delete('bar'); // Returns false. No "bar" element found
//to be deleted.
mySet.delete('foo'); // Returns true.  Successfully removed.

mySet.has('foo'); // Returns false. The "foo" element is no
//longer present.
```

<a name="module_collections-x.SetConstructor+forEach"></a>

#### `set.forEach` ⇒ <code>Object</code>

The forEach() method executes a provided function once per each value
in the Set object, in insertion order.

**Kind**: instance property of [<code>Set</code>](#module_collections-x.SetConstructor)  
**Returns**: <code>Object</code> - The Set object.

| Param     | Type                  | Description                                   |
| --------- | --------------------- | --------------------------------------------- |
| callback  | <code>function</code> | Function to execute for each element.         |
| [thisArg] | <code>\*</code>       | Value to use as this when executing callback. |

**Example**

```js
function logSetElements(value1, value2, set) {
  console.log('s[' + value1 + '] = ' + value2);
}

new SetConstructor(['foo', 'bar', undefined]).forEach(logSetElements);

// logs:
// "s[foo] = foo"
// "s[bar] = bar"
// "s[undefined] = undefined"
```

<a name="module_collections-x.SetConstructor+size"></a>

#### `set.size` : <code>number</code>

The value of size is an integer representing how many entries the Set
object has.

**Kind**: instance property of [<code>Set</code>](#module_collections-x.SetConstructor)  
**Example**

```js
import {SetConstructor} from 'collections-x';

const mySet = new SetConstructor();
mySet.add(1);
mySet.add(5);
mySet.add('some text');

console.log(mySet.size); // 3
```

<a name="module_collections-x.SetConstructor+entries"></a>

#### `set.entries()` ⇒ <code>Object</code>

The entries() method returns a new Iterator object that contains an
array of [value, value] for each element in the Set object, in
insertion order. For Set objects there is no key like in Map objects.
However, to keep the API similar to the Map object, each entry has the
same value for its key and value here, so that an array [value, value]
is returned.

**Kind**: instance method of [<code>Set</code>](#module_collections-x.SetConstructor)  
**Returns**: <code>Object</code> - A new Iterator object.  
**Example**

```js
import {SetConstructor} from 'collections-x';

const mySet = new SetConstructor();
mySet.add('foobar');
mySet.add(1);
mySet.add('baz');

const setIter = mySet.entries();

console.log(setIter.next().value); // ["foobar", "foobar"]
console.log(setIter.next().value); // [1, 1]
console.log(setIter.next().value); // ["baz", "baz"]
```

<a name="module_collections-x.SetConstructor+has"></a>

#### `set.has(value)` ⇒ <code>boolean</code>

The has() method returns a boolean indicating whether an element with the
specified value exists in a Set object or not.

**Kind**: instance method of [<code>Set</code>](#module_collections-x.SetConstructor)  
**Returns**: <code>boolean</code> - Returns true if an element with the specified value
exists in the Set object; otherwise false.

| Param | Type            | Description                                       |
| ----- | --------------- | ------------------------------------------------- |
| value | <code>\*</code> | The value to test for presence in the Set object. |

**Example**

```js
import {SetConstructor} from 'collections-x';

const mySet = new SetConstructor();
mySet.add('foo');

mySet.has('foo'); // returns true
mySet.has('bar'); // returns false
```

<a name="module_collections-x.SetConstructor+keys"></a>

#### `set.keys()` ⇒ <code>Object</code>

The keys() method is an alias for the `values` method (for similarity
with Map objects); it behaves exactly the same and returns values of
Set elements.

**Kind**: instance method of [<code>Set</code>](#module_collections-x.SetConstructor)  
**Returns**: <code>Object</code> - A new Iterator object.  
**Example**

```js
import {SetConstructor} from 'collections-x';

const mySet = new SetConstructor();
mySet.add('foo');
mySet.add('bar');
mySet.add('baz');

const setIter = mySet.keys();

console.log(setIter.next().value); // "foo"
console.log(setIter.next().value); // "bar"
console.log(setIter.next().value); // "baz"
```

<a name="module_collections-x.SetConstructor+values"></a>

#### `set.values()` ⇒ <code>Object</code>

The values() method returns a new Iterator object that contains the
values for each element in the Set object in insertion order.

**Kind**: instance method of [<code>Set</code>](#module_collections-x.SetConstructor)  
**Returns**: <code>Object</code> - A new Iterator object.  
**Example**

```js
import {SetConstructor} from 'collections-x';

const mySet = new SetConstructor();
mySet.add('foo');
mySet.add('bar');
mySet.add('baz');

const setIter = mySet.values();

console.log(setIter.next().value); // "foo"
console.log(setIter.next().value); // "bar"
console.log(setIter.next().value); // "baz"
```

<a name="module_collections-x.SetConstructor+symIt"></a>

#### `set.symIt()` ⇒ <code>Object</code>

The initial value of the @@iterator property is the same function object
as the initial value of the values property.

**Kind**: instance method of [<code>Set</code>](#module_collections-x.SetConstructor)  
**Returns**: <code>Object</code> - A new Iterator object.  
**Example**

```js
import {SetConstructor, symIt} from 'collections-x';

const mySet = new SetConstructor();
mySet.add('0');
mySet.add(1);
mySet.add({});

const setIter = mySet[symIt]();

console.log(setIter.next().value); // "0"
console.log(setIter.next().value); // 1
console.log(setIter.next().value); // Object
```

<a name="module_collections-x.symIt"></a>

### `collections-x.symIt`

The iterator identifier that is in use.

type {Symbol|string}

**Kind**: static property of [<code>collections-x</code>](#module_collections-x)

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