_.toPairs
Turn a dict into a list of key/value pairs, the easy way
- obj
- *
Want to turn {"width": 832, "height": 1216, "steps": 30} into [["width", 832], ["height", 1216], ["steps", 30]]? That's all _.toPairs does. It's one of the auto-generated Underscore.js method nodes in sfinktah's comfy-ovum pack, and if you ever need to flatten a dictionary into an ordered list of pairs - say, to feed into a list-driven loop or a formatter - it beats hand-building that structure with a pile of text nodes.
It's worth knowing up front: the whole ovum/underscore family is the pack author's own warning label. The README literally calls these nodes "an absolute disaster to use in production," a work in progress not recommended for live workflows. _.toPairs is one of the more honest ones - it has exactly one input and no surprising side effects - but it ships with that family reputation, so treat it as a tool for interactive graph-building, not something to bake into a workflow you share with strangers.
How it works
Every _. method node in this pack is a thin auto-generated wrapper around underscore3, a Python port of Underscore.js that's vendored inside the repo (so no separate install). The wrapper inspects the method's signature, exposes the primary argument as an obj input, and returns the method's result directly.
The one twist: if you feed it a _.CHAIN object (the output of a _.chain node or another underscore method node) instead of a plain dict, it keeps the chain going instead of returning a value - so you can build a pipeline like _.chain → _.pairs → _.first and only unwrap at the end with _.value. Give it a plain dict and it just computes the answer.
Inputs and output
Only one input matters: obj (type *, optional), the object you want to convert. The output is also *, so Comfy doesn't know statically that you're getting a list of pairs - wire it into anything that accepts a generic list and you're fine.
One heads-up: a bare obj input means there's no widget you can type into; you have to actually wire something in. Feed it a dict from a node like Workflow Widget To Any or a hardcoded JSON and you're set.
Install
ComfyUI Manager is the easy route - search comfy-ovum and install, then restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum
Restart ComfyUI afterward. No model files to download; the pack's requirements.txt is the standard stuff (requests, pillow, numpy, aiohttp…) and the underscore3 port lives inside the repo, so nothing extra to fetch for this node.
When you'd actually use it
Deduplicating or joining tag lists, converting a small config dict into rows you can iterate over, or passing pairs onward to _.zipObject (its inverse) are the realistic jobs. If your workflow never manipulates dicts, skip it - the value here is "one node instead of a mini-graph," not some exotic capability.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| objopt | * | Primary input object. Also accepts _.CHAIN to continue chaining. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | — |