# map-utility-functions

> A utility function library for working with ES2015 map objects.

Latest version **0.1.0** (published 2017-11-12) · Unlicense license · 0 weekly downloads

## Install

```sh
npm install map-utility-functions
pnpm add map-utility-functions
yarn add map-utility-functions
bun add map-utility-functions
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2017-11-12 |
| First published | 2017-11-12 |
| Weekly downloads | 0 |
| License | Unlicense |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Sean Allen |
| Maintainers | seanjallen |
| Keywords | javascript, es6, map, reduce, assign, some, every, filter |

## Links

- npm: https://www.npmjs.com/package/map-utility-functions
- Repository: https://github.com/seanjallen/map-utility-functions
- Homepage: https://github.com/seanjallen/map-utility-functions#readme
- Issues: https://github.com/seanjallen/map-utility-functions/issues
- npm.io page: https://npm.io/package/map-utility-functions

## Alternatives

- [@fortawesome/react-fontawesome](https://npm.io/package/@fortawesome/react-fontawesome.md) — 2.2M weekly downloads
- [roboto-fontface](https://npm.io/package/roboto-fontface.md) — 196.0K weekly downloads
- [@react-native-vector-icons/common](https://npm.io/package/@react-native-vector-icons/common.md) — 150.4K weekly downloads
- [stockfish](https://npm.io/package/stockfish.md) — 27.0K weekly downloads
- [@procore/core-icons](https://npm.io/package/@procore/core-icons.md) — 4.6K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2017-11-12

## README

# map-utility-functions
A utility function library for working with ES2015 map objects.

## API

### assign(target: Map, sources: ...Map): Map

Works the same as [Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign), but for maps instead of objects.

```javascript
const assign = require('map-utility-functions').assign;
// import { assign } from 'map-utility-functions'; // ES2015 syntax
const x = new Map();
x.set('key1', 1);
x.set('key2', 2);
const y = new Map();
y.set('key2', 5);
y.set('key3', 6);
assign(x, y); // Map { 'key1' => 1, 'key2' => 5, 'key3' => 6 }
```

### every(map: Map, callback: function(value: *, key: *, map: Map): boolean, thisArg: *): boolean

Works the same as [Array.every](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every), but for maps instead of arrays.

```javascript
const every = require('map-utility-functions').every;
// import { every } from 'map-utility-functions'; // ES2015 syntax
const x = new Map();
x.set('key1', 5);
x.set('key2', 6);
every(x, (value) => value > 1); // true
every(x, (value, key) => key.startsWith('test')); // false
```

### filter(map: Map, callback: function(value: *, key: *, map: Map): boolean, thisArg: *): Map

Works the same as [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter), but for maps instead of arrays.

```javascript
const filter = require('map-utility-functions').filter;
// import { every } from 'map-utility-functions'; // ES2015 syntax
const x = new Map();
x.set('key1', 1);
x.set('key2', 2);
const y = filter(x, (value) => value > 1); // Map { 'key2' => 2 }
const z = filter(x, (value, key) => key === 'key1'); // Map { 'key1' => 1 }
```

### reduce(map: Map, callback: function(accumulator: *, value: *, key: *, map: Map): *, initialValue: *): *

Works the same as [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce), but for maps instead of arrays.

```javascript
const reduce = require('map-utility-functions').reduce;
// import { reduce } from 'map-utility-functions'; // ES2015 syntax
const x = new Map();
x.set(1, 1);
x.set(2, 2);
x.set(3, 3);
reduce(x, (accumulator, value, key) => accumulator + value + key, 0); // 12
```

### some(map: Map, callback: function(value: *, key: *, map: Map): boolean, thisArg: *): boolean

Works the same as [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some), but for maps instead of arrays.

```javascript
const some = require('map-utility-functions').some;
// import { some } from 'map-utility-functions'; // ES2015 syntax
const x = new Map();
x.set('key1', 1);
x.set('key2', 2);
some(x, (value) => value > 0); // true
some(x, (value, key) => key.length > 10); // false
```

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