Function zipKeyValue

Zips together an array of keys and values into an object. Requires that keys and values are the same length.

const o = zipKeyValue([`a`, `b`, `c`], [0, 1, 2])
Yields: { a: 0, b: 1, c: 2}
  • Type Parameters

    • V

      Type of values

    Parameters

    • keys: readonly string[]

      String keys

    • values: ArrayLike<undefined | V>

      Values

    Returns {
        [k: string]: T;
    }

    Object with keys and values

    • [k: string]: T