# es6-map

> ECMAScript6 Map polyfill

Latest version **0.1.5** (published 2017-03-17) · MIT license · 0 weekly downloads

## Install

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

## 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.5 |
| Published | 2017-03-17 |
| First published | 2013-11-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 73 |
| Author | Mariusz Nowak |
| Maintainers | medikoo |
| Keywords | collection, es6, shim, harmony, list, hash, map, polyfill, ponyfill, ecmascript |

## Links

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

## Dependencies (6)

- [d](https://npm.io/package/d.md) 1
- [es5-ext](https://npm.io/package/es5-ext.md) ~0.10.14
- [es6-set](https://npm.io/package/es6-set.md) ~0.1.5
- [es6-symbol](https://npm.io/package/es6-symbol.md) ~3.1.1
- [es6-iterator](https://npm.io/package/es6-iterator.md) ~2.0.1
- [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.5 (latest) — 2017-03-17
- 0.1.4 — 2016-06-03
- 0.1.3 — 2015-11-18
- 0.1.2 — 2015-10-15
- 0.1.1 — 2014-10-07
- 0.1.0 — 2014-04-29
- 0.0.1 — 2014-04-25
- 0.0.0 — 2013-11-10

## README

# es6-map
## Map 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

It’s safest to use *es6-map* as a [ponyfill](https://ponyfill.com) – a polyfill which doesn’t touch global objects:

```javascript
var Map = require('es6-map');
```

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

```javascript
require('es6-map/implement');
```

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

```javascript
var Map = require('es6-map/polyfill');
```

### Installation

	$ npm install es6-map

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-map-objects). Still if you want quick look, follow examples:

```javascript
var Map = require('es6-map');

var x = {}, y = {}, map = new Map([['raz', 'one'], ['dwa', 'two'], [x, y]]);

map.size;                 // 3
map.get('raz');           // 'one'
map.get(x);               // y
map.has('raz');           // true
map.has(x);               // true
map.has('foo');           // false
map.set('trzy', 'three'); // map
map.size                  // 4
map.get('trzy');          // 'three'
map.has('trzy');          // true
map.has('dwa');           // true
map.delete('dwa');        // true
map.size;                 // 3

map.forEach(function (value, key) {
  // { 'raz', 'one' }, { x, y }, { 'trzy', 'three' } iterated
});

// FF nightly only:
for (value of map) {
 // ['raz', 'one'], [x, y], ['trzy', 'three'] iterated
}

var iterator = map.values();

iterator.next(); // { done: false, value: 'one' }
iterator.next(); // { done: false, value: y }
iterator.next(); // { done: false, value: 'three' }
iterator.next(); // { done: true, value: undefined }

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

## Tests [![Build Status](https://travis-ci.org/medikoo/es6-map.png)](https://travis-ci.org/medikoo/es6-map)

	$ npm test

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