ComfyUI Node

_.find

_.find hands you the item, not the index

By sfinktah·Created about a year ago·Updated 10 months ago· 7
_.find
  • list_or_dict
  • predicate
  • *
predicate_json

_.find is the node in this family you'll actually reach for. Give it a list and a condition, and it walks the list left to right, returning the first element that passes the test - and it stops the moment it finds one, so it doesn't waste time on the rest. No match? You get None back instead of a crash. That's the whole job.

It's one of a family of _.* nodes in sfinktah/comfy-ovum, all auto-generated wrappers around underscore3, a Python port of Underscore.js. Same skeleton everywhere: one primary input, the method's arguments, one output.

When you'd use it

Any time you have a list of structured values and want "the one that satisfies this," rather than a filtered list. Classic ComfyUI example: a list of tag objects with a confidence score, and you want the first tag above a threshold to feed into your prompt. Or a list of config dicts and you want the first one with enabled: true. That's _.find - one value out, exactly the one you care about.

The inputs that matter

  • list_or_dict - the collection to search. A Python list of anything (dicts, strings, numbers), or a dict. It's a loose * input, so it also accepts a _.CHAIN to continue chaining.
  • predicate - the condition. An ANY input; wire in a function object if you have one.
  • predicate_json - this is the one you'll actually type in. When predicate isn't connected, this multiline string is parsed as JSON (or a plain selector). Put a property name in quotes like "enabled" to search by that key, {"enabled": true} for object shorthand, or a number. The mechanism is Underscore's iteratee transform: a string becomes a property accessor, an object becomes a match-against, a callable gets called with (value, index, list).

The single output is a loose * - the matched value, or None. The node's status line shows the result type and a peek at its repr, which is handy when you're not sure what shape came back.

Install

ComfyUI Manager, search "comfy-ovum", install. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum

Restart ComfyUI, then look under ovum/underscore in the node menu. No model files, no heavy deps - the underscore3 port ships inside the pack.

Honest warnings

The README says it plainly: these underscore nodes are "an absolute disaster to use in production," a work in progress. Treat _.find as a quick experiment node, not a load-bearing pillar of a workflow you share. And one real quirk: if you feed a _.CHAIN in as the primary input, you get a _.CHAIN back - you must run _.value to pull the actual found item out. That trips people who wire a chain straight into the next node expecting a value.

Categoryovum/underscore

Inputs (3)

NameTypeDefaultDescription
list_or_dictopt*Primary input object (expected collection). You can still pass any JSON-serializable value. Also accepts _.CHAIN to continue chaining.
predicateopt*predicate: ANY input to override widget. Accepts function, key string, or object shorthand.
predicate_jsonoptSTRINGpredicate_json: JSON or key selector. Used when 'predicate' input is not connected.

Outputs (1)

NameTypeDescription
**