# zipmap

> Returns a map with the keys mapped to the corresponding vals.

Latest version **1.1.1** (published 2014-11-17) · ISC license · 0 weekly downloads

## Install

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

## 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.1.1 |
| Published | 2014-11-17 |
| First published | 2014-03-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Trevor Landau |
| Maintainers | landau |
| Keywords | functional, zip, map, hashmap, object, keys, values, vals, array, associate |

## Links

- npm: https://www.npmjs.com/package/zipmap
- Repository: https://github.com/landau/zipmap
- Issues: https://github.com/landau/zipmap/issues
- npm.io page: https://npm.io/package/zipmap

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 1.1.1 (latest) — 2014-11-17
- 1.1.0 — 2014-11-14
- 1.0.2 — 2014-11-14
- 1.0.1 — 2014-03-28
- 1.0.0 — 2014-03-26

## README

[![Build Status](https://travis-ci.org/landau/zipmap.svg)](https://travis-ci.org/landau/zipmap)

zipmap
======

Returns a map with the keys mapped to the corresponding vals. `zipmap` also accepts a single value of objects or pairs.

> Note: If you use objects, you must use the props `key` and `value`

```js
/**
 * Returns a map with the keys mapped to the corresponding vals.
 *
 * @param {array} keys
 * @param {array} [vals]
 *
 * @return {object}
 */
function zipmap(keys, vals) { }
```

## Install

`npm i -S zipmap`

## Usage

```js
var assert = require('assert');
var zipmap = require('zipmap');

var keys = ['a', 'b', 'c'];
var vals = [1, 2, 3];

var map = zipmap(keys, vals);
assert.deepEqual(map, { a: 1, b: 2, c: 3 });
```

Or use an array of objects

```js
var objs = [
  { key: 'foo', value: 'bar' },
  { key: 'hi', value: 'bye' },
];

var out = {
  foo: ',
  hi: 'bye'
};

var map = zipmap(objs);
assert.deepEqual(map, out);
```

or use an array of pairs

```js
var pairs = [
  ['foo', 'bar'],
  ['hi', 'bye']
];

var out = {
  foo: 'bar',
  hi: 'bye'
};

var map = zipmap(pairs);
assert.deepEqual(map, out);
```

## Changelog

#### 1.1.1

- Return empty obj when given an array of len 0

#### 1.1.0

- Add single argument handling which allows objects or pairs

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