_.zipObject
Build a dict from two parallel lists
- obj
- values
- manyValues
- *
_.zipObject is how you turn two parallel lists into a dictionary: an array of keys and an array of values become {key1: value1, key2: value2, ...}. It's the inverse of _.toPairs (which is _.pairs - turn a dict into [key, value] pairs), so between the two you can round-trip a dictionary through list-land. It's the "build a config object" node in the ovum/underscore family of comfy-ovum.
Family reputation first, because the README says it with zero ambiguity: the underscore nodes are "an absolute disaster to use in production," a work in progress, not recommended for live workflows. _.zipObject has a genuinely useful third mode (manyValues) that most of the family doesn't offer, so it's one of the more interesting nodes here - but it's also one where you should test your input shape before trusting the output.
How it works
The node wraps underscore3, the vendored Python port of Underscore.js, via the pack's auto-generated wrapper. The core operation: take a list of keys and a list of values and zip them into a dict. Underscore's object/zipObject also accepts a single list of [key, value] pairs, which is the reverse of _.pairs. The third mode is the fun one: manyValues=true treats the input as [key, value1, value2, ...] and produces {key: [value1, value2, ...]} - handy for grouping several values under one key.
Inputs and output
obj- the primary input (type*, optional; also accepts a_.CHAIN). Depending on mode this is the key array, the array of pairs, or the[key, value1, value2, ...]list.values- the values array when you're zipping two lists (type*).manyValues- the grouping flag (type*, pass a truthy value liketrueto enable). Note it's a generic input here rather than a tidy checkbox, so wire a BOOLEAN ortruein.- Output:
*.
The exact meaning of obj shifts with which mode you're in, which is the part to keep straight - check the tooltips on each socket and test once with a tiny list.
Install
Manager: search comfy-ovum, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum
Restart. No model downloads; underscore3 ships inside the repo.
When it's worth it
Building a dict on the fly is the use case: collect a set of parameter values, zip them with their names, and hand the resulting object to something that expects structured data. Paired with _.toPairs, it's also your round-trip path for getting a dict into list-processing territory and back. It's a small node, but the manyValues grouping trick is the kind of thing you'll be glad exists the day you need to group a flat list by key.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| objopt | * | Primary input object. Also accepts _.CHAIN to continue chaining. | |
| valuesopt | * | values: JSON allowed for arrays/objects where applicable. | |
| manyValuesopt | * | manyValues: JSON allowed for arrays/objects where applicable. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | — |