# weakmap-polyfill

> ECMAScript6 WeakMap polyfill

Latest version **2.0.4** (published 2021-06-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install weakmap-polyfill
pnpm add weakmap-polyfill
yarn add weakmap-polyfill
bun add weakmap-polyfill
```

## 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 | 2.0.4 |
| Published | 2021-06-06 |
| First published | 2015-10-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.10.0 |
| Dependencies | 0 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 32 |
| Author | polygonplanet |
| Maintainers | polygonplanet |
| Keywords | ecmascript, es2015, es6, javascript, polyfill, shim, weakmap |

## Links

- npm: https://www.npmjs.com/package/weakmap-polyfill
- Repository: https://github.com/polygonplanet/weakmap-polyfill
- Issues: https://github.com/polygonplanet/weakmap-polyfill/issues
- npm.io page: https://npm.io/package/weakmap-polyfill

## Recent versions

- 2.0.4 (latest) — 2021-06-06
- 2.0.3 — 2021-01-13
- 2.0.2 — 2020-04-07
- 2.0.1 — 2020-01-15
- 2.0.0 — 2016-04-27
- 1.0.1 — 2015-10-19
- 1.0.0 — 2015-10-09

## README

weakmap-polyfill
================

[![NPM Version](https://img.shields.io/npm/v/weakmap-polyfill.svg)](https://www.npmjs.com/package/weakmap-polyfill)
[![Build Status](https://travis-ci.com/polygonplanet/weakmap-polyfill.svg?branch=master)](https://travis-ci.com/polygonplanet/weakmap-polyfill)
[![Bundle Size (minified)](https://img.shields.io/github/size/polygonplanet/weakmap-polyfill/weakmap-polyfill.min.js.svg)](https://github.com/polygonplanet/weakmap-polyfill/blob/master/weakmap-polyfill.min.js)
[![GitHub License](https://img.shields.io/github/license/polygonplanet/weakmap-polyfill.svg)](https://github.com/polygonplanet/weakmap-polyfill/blob/master/LICENSE)

[ECMAScript6 WeakMap](http://www.ecma-international.org/ecma-262/6.0/#sec-weakmap-objects) polyfill.

## Installation

### npm

```bash
$ npm install --save weakmap-polyfill
```

### Usage

Import or require `weakmap-polyfill`, then **WeakMap** will be defined in the global scope if native WeakMap is not supported in running environment.

#### using `import`

```javascript
import 'weakmap-polyfill';
const weakMap = new WeakMap();
```

#### using `require`

```javascript
require('weakmap-polyfill');
var weakMap = new WeakMap();
```

#### browser (standalone)

```html
<script src="weakmap-polyfill.min.js"></script>
<script>
var weakMap = new WeakMap();
</script>
```

## Compatibility

* Chrome 15
* Firefox 3
* IE 7
* Safari 4
* Opera 11.5
* Edge

### Browser Tests

* [Browser Test](http://polygonplanet.github.io/weakmap-polyfill/browser-tests/index.html)
* [Browser Test for Legacy](https://polygonplanet.github.io/weakmap-polyfill/browser-tests/legacy.html)

## Limitations

This polyfill has following few limitations.

* WeakMap `iterable` argument is not supported. ([23.3.1.1 WeakMap ( \[ iterable \] )](https://www.ecma-international.org/ecma-262/6.0/index.html#sec-weakmap-iterable))
* Frozen and sealed objects are not supported.
* The values held by a WeakMap can't be collected once the map itself is GCed, since the values here are tied to the keys. [#4](https://github.com/polygonplanet/weakmap-polyfill/issues/4)

## License

MIT

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