Nodes/comfy-ovum/_.detect
ComfyUI Node

_.detect

The alias for “find the first match”

By sfinktah·Created about a year ago·Updated 10 months ago· 7
_.detect
  • obj
  • *

_.detect is the legacy Underscore alias for _.find: it walks a collection and returns the first element that passes a truth test. The author's description is blunt: "Return the first value which passes a truth test. Aliased as detect." If you've got a list of prompts, configs, or results and you need the earliest one that satisfies some condition, this is the search.

Same caveat as its sibling _.collect: in this generated node, only the primary obj input is exposed - the predicate that decides what counts as a pass isn't wired onto the socket in this build. So for practical "find me the first match" work, the _.find node (also in this pack) is the one with the full predicate controls. _.detect exists to keep the alias alive, and to satisfy workflows that reference the old name.

How it works

Generated wrapper around underscore3, the bundled Python port of Underscore.js. The method iterates in order and stops at the first element where the predicate is truthy, returning that element (or undefined/None if nothing matches). That "first one, then stop" behavior is the whole point - it's why you'd pick find over filter, which scans everything and returns all matches.

Because the node as generated doesn't expose the predicate input, feeding it a raw list without a chain yields essentially the first element (or the port's default behavior with no predicate). For real predicate-driven searches, _.find is your node.

Inputs and output

  • obj (any type) - the collection to search. Accepts a _.CHAIN to continue a chain.
  • Output: * (any type) - the first matching value, or None/undefined if nothing matched.

No widgets on the surface.

Installing it

Part of sfinktah/comfy-ovum ("comfy-ovum"):

  • ComfyUI Manager: search "comfy-ovum", install, restart.
  • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/sfinktah/comfy-ovum, restart.

No model downloads; light dependencies; underscore3 bundled in the repo.

The honest take

Use _.detect if a downloaded workflow references it or you want the old-school name in a chain. Otherwise reach for _.find. This is precisely the kind of half-finished generated wrapper the author's README is warning about when it calls the underscore suite a work-in-progress "disaster to use in production": the naming came through, the inputs didn't. Know what it's supposed to do, use _.find when it matters, and treat _.detect as the compatibility alias it is.

Categoryovum/underscore

Inputs (1)

NameTypeDefaultDescription
objopt*Primary input object. Also accepts _.CHAIN to continue chaining.

Outputs (1)

NameTypeDescription
**