Function zipObject

  • This function is like fromPairs except that it accepts two arrays, one of property identifiers and one of corresponding values.

    Contribution to minified bundle size, when it is the only function imported:

    • Lodash: 2,252 bytes
    • Micro-dash: 349 bytes

    Type Parameters

    • K extends readonly [PropertyKey]
    • V extends readonly [any, any]

    Parameters

    • props: K
    • values: V

    Returns {
        [k in K[0]]: V[0]
    }

  • Type Parameters

    • K extends readonly [PropertyKey, PropertyKey]
    • V extends readonly [any, any, any]

    Parameters

    • props: K
    • values: V

    Returns {
        [k in K[0]]: V[0]
    } & {
        [k in K[1]]: V[1]
    }

  • Type Parameters

    • K extends readonly [PropertyKey, PropertyKey, PropertyKey]
    • V extends readonly [any, any, any, any]

    Parameters

    • props: K
    • values: V

    Returns {
        [k in K[0]]: V[0]
    } & {
        [k in K[1]]: V[1]
    } & {
        [k in K[2]]: V[2]
    }

  • Type Parameters

    • K extends readonly [PropertyKey, PropertyKey, PropertyKey, PropertyKey]
    • V extends readonly [any, any, any, any, any]

    Parameters

    • props: K
    • values: V

    Returns {
        [k in K[3]]: V[3]
    } & {
        [k in K[0]]: V[0]
    } & {
        [k in K[1]]: V[1]
    } & {
        [k in K[2]]: V[2]
    }

  • Type Parameters

    • K extends PropertyKey
    • V

    Parameters

    • props: readonly K[]
    • values: readonly V[]

    Returns {
        [k in K]: V | undefined
    }