Repository URL to install this package:
|
Version:
6.0.4 ▾
|
import { AnyArray, AnyObj } from '../_typings'
// 1. using `prop` - same with `index`
// 2. to `object` or `array`
//
// Array + Object => Array
// Object + Array => Array
// Object + Object => Array
// Array + Array => Array
export default function zipFromArrayObj(array: AnyArray, object: AnyObj) {
const length = array.length
const result = new Array(length)
let idx = 0
while (idx < length) {
const key = array[idx]
result[idx] = [key, object[key]]
idx += 1
}
return result
}