Skip to content

zipToObject

Combine multiple arrays in sets

214 bytes

Usage

Creates an object mapping the keys in the first array to their corresponding values in the second array.

import * as _ from 'radashi'
const names = ['ra', 'zeus', 'loki']
const cultures = ['egypt', 'greek', 'norse']
_.zipToObject(names, cultures)
// => { ra: egypt, zeus: greek, loki: norse }
_.zipToObject(names, (k, i) => k + i)
// => { ra: ra0, zeus: zeus1, loki: loki2 }
_.zipToObject(names, null)
// => { ra: null, zeus: null, loki: null }