• Combine keys with corresponding items in values to form and return an object. values could be undefined may not have items corresponding to some keys but all keys must be provided.

    Values that map to the same keys are combined into an array. The check for this incurs a performance penalty. If you are sure there are no repetitions, pass the noRepeat flag (as a truthy value) to skip the checks.

    Type Parameters

    • T

    Parameters

    • keys: Iterable<IKey>
    • Optional values: Iterable<any>
    • noRepeat: boolean = false

    Returns T

    Example

    import { zip } from 'deleight/object/operations'
    const obj = zip(['a', 'b', 'c'], [1, 2, 3]);
    console.log(obj) // { a: 1, b: 2, c: 3 }