# tuplemap

> A Map which accepts multiple objects as a key.

Latest version **1.0.2** (published 2016-12-21) · MPL-2.0 license · 0 weekly downloads

## Install

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

## 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.2 |
| Published | 2016-12-21 |
| First published | 2016-12-21 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | @louis_remi |
| Maintainers | louisremi |
| Keywords | cache, map, tuple |

## Links

- npm: https://www.npmjs.com/package/tuplemap
- npm.io page: https://npm.io/package/tuplemap

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2016-12-21
- 1.0.1 — 2016-12-21
- 1.0.0 — 2016-12-21

## README

TupleMap [![npm version](https://badge.fury.io/js/tuplemap.svg)](https://badge.fury.io/js/tuplemap) [![Build Status](https://travis-ci.org/memoize-immutable/tuplemap.svg?branch=master)](https://travis-ci.org/memoize-immutable/tuplemap) [![Dependency Status](https://david-dm.org/memoize-immutable/tuplemap.svg)](https://david-dm.org/memoize-immutable/tuplemap) [![Coverage Status](https://coveralls.io/repos/github/memoize-immutable/tuplemap/badge.svg?branch=master)](https://coveralls.io/github/memoize-immutable/tuplemap?branch=master)
========

A Map which accepts multiple objects as a key.
This lib is one of the several possible cache for [memoize-immutable](/louisremi/memoize-immutable),
but it can suit other use-cases as it implements a usual Map API.

## Install

`npm install --save TupleMap`

This lib has no dependency, but requires a native implementation of Map.

## Usage

```js
var TupleMap = require('TupleMap');

// When the `limit` option is set, TupleMap turns into an LRU cache.
// Clearing the map every X seconds can also be an acceptable strategy sometimes.
var cache = new TupleMap({ limit: 10000 });

var keyPart1 = {};
var keyPart2 = 'yolo';
var keyPart3 = [];
var value = {any: 'thing'};

// Note that following keyPart tuples are wrapped in new arrays that are !==
// (otherwise a Map would have been enough).
cache.set([keyPart1, keyPart2, keyPart3], value);

cache.has([keyPart1, keyPart2, keyPart3]) === true;
cache.get([keyPart1, keyPart2, keyPart3]) === value;
```

## When should you use this map?

This map should be used with functions that take more than one argument.
It is a less efficient but more flexible alternative to WeakTupleMap.

## Author

[@louis_remi](https://twitter.com/louis_remi)

## License

MPL-2.0

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