• Converts an iterable of key-value pairs into an object. This is the inverse of Object.entries. it is a bit similar to zip but the object is created by joining in the other axis.

    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

    • pairs: Iterable<[IKey, any]>
    • noRepeat: boolean = false

    Returns T

    the created object

    Example

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