An open API service indexing awesome lists of open source software.

https://github.com/haykam821/pair-into-object

Merges two pairs of arrays into a single object.
https://github.com/haykam821/pair-into-object

array merge object pair

Last synced: 9 months ago
JSON representation

Merges two pairs of arrays into a single object.

Awesome Lists containing this project

README

          

# Pair Into Object [![Build Status](https://travis-ci.org/haykam821/Pair-Into-Object.svg?branch=master)](https://travis-ci.org/haykam821/Pair-Into-Object)

This single-function library merges two arrays of keys and values respectively into a single object.

For example, with the input key array being `["a", "b", "c"]` and the input value array being `[1, 2, 3]`, you would get the object `{"a": 1, "b": 2, "c": 3}`.

## Errors

If your key or value input is *not* an array, a TypeError will be thrown. If the key and value input arrays do not match in length, an Error will be thrown.