For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /reference/fp/zipObject.md.

zipObject (Functional Programming) es-toolkit

Creates a function that builds an object from keys and values. Use it with pipe.

const result = pipe(array, zipObject(values));
Info

Prefer the original es-toolkit zipObject in ordinary code. Use this fp variant when composing transformations with pipe.

Usage

zipObject uses the piped array as keys and pairs each key with the value at the same index in values.

import { pipe, zipObject } from 'es-toolkit/fp';

pipe(['a', 'b'] as const, zipObject([1, 2])); // => { a: 1, b: 2 }

Parameters

valuesreadonly V[]required

The values assigned to keys from the piped array by index.

Returns

A function that maps keys to an object built from values.

(keys: readonly P[]) => Record<P, V>
Source: es-toolkit

Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.