# array-2-map

> convert array to map

Latest version **1.0.2** (published 2019-08-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install array-2-map
pnpm add array-2-map
yarn add array-2-map
bun add array-2-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.2 |
| Published | 2019-08-17 |
| First published | 2019-08-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | LuanMingyang |
| Maintainers | luannn |
| Keywords | utils, array, map, object, array-to-map, array-to-object |

## Links

- npm: https://www.npmjs.com/package/array-2-map
- Repository: https://github.com/LuanMingyang/array-2-map
- Issues: https://github.com/LuanMingyang/array-2-map/issues
- npm.io page: https://npm.io/package/array-2-map

## Recent versions

- 1.0.2 (latest) — 2019-08-17
- 1.0.1 — 2019-08-17

## README

# array-2-map

[![Build Status](https://travis-ci.org/LuanMingyang/array-2-map.svg?branch=master)](https://travis-ci.org/LuanMingyang/array-2-map)
[![Coverage Status](https://coveralls.io/repos/github/LuanMingyang/array-2-map/badge.svg?branch=master)](https://coveralls.io/github/LuanMingyang/array-2-map?branch=master)
[![License](https://img.shields.io/github/license/LuanMingyang/array-2-map.svg?maxAge=2592000)](https://github.com/LuanMingyang/array-2-map/blob/master/LICENSE)

A tool that converts an array to a map.

## Installation

```
npm install array-2-map
```

## Usage

```javascript
const toKeyMap = require('array-2-map');

const map = toKeyMap([1, 2, "abc"]);

const array = [
  { value: 'key1', label: 'KEY1' },
  { value: 'key2', label: 'KEY2' }
];

const map1 = toKeyMap(array, 'value');
// { key1: { value: 'key1', label: 'KEY1' }, key2: { value: 'key2', label: 'KEY2' } }

const map2 = toKeyMap(array, 'value', x => x.label);
// {key1: "KEY1", key2: "KEY2"}
```

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