# weakrefmap

> WeakRefMap using WeakRef

Latest version **1.0.0** (published 2021-06-25) · Unlicense license · 0 weekly downloads

## Install

```sh
npm install weakrefmap
pnpm add weakrefmap
yarn add weakrefmap
bun add weakrefmap
```

## 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 | 2021-06-25 |
| First published | 2021-06-25 |
| Weekly downloads | 0 |
| License | Unlicense |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Lunuy |
| Maintainers | lunuy |
| Keywords | WeakRef, WeakRefMap, Map |

## Links

- npm: https://www.npmjs.com/package/weakrefmap
- Repository: https://github.com/Lunuy/weakrefmap
- Homepage: https://github.com/Lunuy/weakrefmap#readme
- Issues: https://github.com/Lunuy/weakrefmap/issues
- npm.io page: https://npm.io/package/weakrefmap

## Recent versions

- 1.0.0 (latest) — 2021-06-25

## README

# weakrefmap
WeakRefMap using WeakRef

# Example
```js
const { WeakRefMap } = require('weakrefmap');

function sleep(ms) {
    return new Promise(solve => setTimeout(solve, ms));
}

const weakRefMap = new WeakRefMap();

setInterval(() => {
    console.log(Array.from(weakRefMap.entries()), weakRefMap.size);
}, 1000);

let a = {a:'a'};
let b = {b:'b'};

(async () => {
    weakRefMap.set(1, a);
    weakRefMap.set(2, b);
    
    await sleep(1000);
    weakRefMap.delete(1);
    await sleep(1000);
    b = undefined;
})();
```

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