_.pluckAsObject
The Underscore Node Whose Author Left a Question Mark
- obj
- *
_.pluckAsObject is the node whose own description is "Might be the same as pick?" - and honestly, that question mark tells you everything you need to know. This is the one member of the underscore family that ships in a half-finished state, and the honest advice is: skip it, and use _.pluck or _.pick instead. I'll explain why, because it's genuinely confusing to look at.
What it claims to do
The name suggests the useful thing: pluck a property out of every item and collect the results into an object, rather than a plain list. If it worked the way you'd hope, it would be a "make an index from this field" node - turn a list of records into a dict keyed by one of their fields. That would be handy.
What it actually does
I ran the shipped code. Two outcomes, neither of which is what the name implies:
- Single key (the widget's normal case): it returns an empty list. Every time. The implementation only has a branch for a two-element key list; a plain string key falls through and produces
[]. - Two-element key array: it returns a list of
(k, j)tuples - which is just_.pluckwith a two-key list, nothing object-shaped about it.
So with the key STRING widget - the only control the node exposes - you get an empty list back for any real use. The interface is:
obj- the list of objects (or a_.CHAIN)key- a string widget, which currently leads to the empty result
Output is a single ANY slot.
What to use instead
- Want the values of one field as a list?
_.pluck. - Want a dict built from specific keys?
_.pick(whitelist) or_.omit(blacklist). - Want a dict keyed by a field from a list of records? That's a
groupBy/indexBy-style operation, which this family has - feed the records in and the field name as the iteratee.
How to tell if it's fixed
This is one to re-test after a pack update rather than trust. The node is auto-generated from the bundled underscore.js port, so a fix upstream in the pluckAsObject method would flow through. Until then, the question mark in the description is doing real work: this is a stub, not a tool.
Installing
Part of comfy-ovum. ComfyUI Manager → search comfy-ovum → Install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum
Restart ComfyUI. No models, no extra pip packages for the underscore nodes.
The bottom line
A good idea that never got finished - the author knows it, and now you do too. Reach for _.pluck or _.pick and you'll get the same job done without the empty list.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| objopt | * | Primary input object. Also accepts _.CHAIN to continue chaining. | |
| keyopt | STRING | key (string) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | — |