# map-or-similar

> A JavaScript (JS) Map or Similar object polyfill if Map is not available.

Latest version **1.5.0** (published 2017-01-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install map-or-similar
pnpm add map-or-similar
yarn add map-or-similar
bun add map-or-similar
```

## 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.5.0 |
| Published | 2017-01-20 |
| First published | 2016-02-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Baz |
| Maintainers | thinkloop |
| Keywords | map, polyfill, javascript, js, alternative, fast |

## Links

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

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.5.0 (latest) — 2017-01-20
- 1.4.0 — 2017-01-20
- 1.3.0 — 2016-12-09
- 1.2.3 — 2016-05-19
- 1.2.1 — 2016-05-19
- 1.2.0 — 2016-05-19
- 1.1.4 — 2016-05-19
- 1.1.3 — 2016-02-03
- 1.1.2 — 2016-02-03
- 1.1.1 — 2016-02-03
- 1.0.6 — 2016-02-03
- 1.0.5 — 2016-02-03
- 1.0.4 — 2016-02-03
- 1.0.3 — 2016-02-03
- 1.0.2 — 2016-02-03
- … 1 more at https://npm.io/package/map-or-similar/versions

## README

# Map Or Similar
Returns a JavaScript Map() or a similar object with the same interface, if Map is not available.
Focuses on performance.
No dependencies.
Made for the browser and nodejs.

## Install
```javascript
npm install map-or-similar --save
```

## Use
```javascript
var MapOrSimilar = require('map-or-similar');

// make a new map or similar object
var myMap = new MapOrSimilar();

// use it like a map
myMap.set('key1', 'value1');
myMap.set({ val: 'complex object as key' }, 'value2');
```

The following methods and properties are supported identically to Map():

```Slim
set(key, val)     : Sets a value to a key. Key can be a complex object, array, etc.
get(key)          : Returns the value of a key.
has(key)          : Returns true if the key exists, otherwise false.
delete(key)       : Deletes a key and its value.
forEach(callback) : Invokes callback(val, key, object) once for each key-value pair in insertion order.
size              : Returns the number of keys-value pairs.
```

Does not support other Map methods or properties.

## Test
```javascript
npm run test
```

## License

Released under an MIT license.

### Other Libs

- [Memoizerific](https://github.com/thinkloop/memoizerific): Fastest, smallest, most-efficient JavaScript memoization lib to memoize JS functions.
- [Multi Key Cache](https://github.com/thinkloop/multi-key-cache): A JavaScript (JS) cache that can have multiple complex values as keys.

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