# thunky-map

> A map version of thunky

Latest version **1.0.1** (published 2020-03-25) · MIT license · 0 weekly downloads

## Install

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

## 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.1 |
| Published | 2020-03-25 |
| First published | 2020-03-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Mathias Buus |
| Maintainers | mafintosh |

## Links

- npm: https://www.npmjs.com/package/thunky-map
- Repository: https://github.com/mafintosh/thunky-map
- Issues: https://github.com/mafintosh/thunky-map/issues
- npm.io page: https://npm.io/package/thunky-map

## Recent versions

- 1.0.1 (latest) — 2020-03-25
- 1.0.0 — 2020-03-10

## README

# thunky-map

A map version of [thunky](https://github.com/mafintosh/thunky)

```
npm install thunky-map
```

## Usage

``` js
const ThunkyMap = require('thunky-map')

const m = new ThunkyMap(function (key, cb) {
  // load the resource async
  // only ran once per key
  setTimeout(function () {
    cb(null, key)
  }, 1000)
})

// triggers the load function above
m.get('hi', function (err, val) {
  // ...
})

// does not as it's already running
m.get('hi', function (err, val) {
  // ...
})
```

## API

#### `m = new ThunkyMap(load)`

Make a new ThunkyMap instance. load should be a function taking a key and callback argument
and should return a value.

#### `m.get(key, cb)`

Get a key. Triggers the load if the key hasn't been loaded before.

#### `m.delete(key)`

Delete a value

#### `m.has(key)`

Check if the map has a value

## License

MIT

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