ComfyUI Node

_.any

Does anything in your list pass the test?

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

_.any is the existential check from Underscore.js, wrapped as a ComfyUI node: feed it a collection and a predicate truth test, and it returns true the moment any single element passes. It short-circuits hard - the first hit stops the traversal, which is exactly what you want from a "is there at least one X here?" question.

The node's description is the spec: "Returns true if any of the values in the list pass the predicate truth test. Short-circuits and stops traversing the list if a true element is found."

When you'd reach for it

The flip side of _.all: instead of "does everything pass," it answers "does anything pass." Any seed above a threshold, any file that exists, any item non-empty, any node in a batch that meets a criterion. Wire the BOOLEAN into a conditional branch and you've built a "proceed if something qualifies" gate.

How it works

Same machinery as the whole underscore family in this pack. Your input gets deep-copied into an Underscore chain (nothing mutates), the any method runs, and the boolean comes out. The predicate is "transformed through iteratee to facilitate shorthand syntaxes," so simple tests can be expressed as property names or JSON match objects rather than full functions.

The primary input is obj (optional, *): the list, dict, or collection to test. Like the rest of the family, it also accepts a _.CHAIN object to continue a chain built by _.chain or other underscore nodes - feed a chain in, get a chain result back that you can keep piping. Output is a single BOOLEAN.

The catch you need to hear

The pack's README does not mince words about this family: "These are an absolute disaster to use in production. They are a WORK IN PROGRESS and are not recommended for use in workflows." That's the author's own flag. For a quick one-off check in a scratch workflow, _.any behaves as advertised. For anything you'll depend on long-term, the predicate UI is where the rough edges live, and the WIP label is honest.

Installing it

Part of the comfy-ovum pack:

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

Restart ComfyUI, or ComfyUI Manager → search "comfy-ovum" → Install. The underscore port is bundled; nothing extra to download.

Common gotchas

  • Short-circuiting means order-dependent results. If element 3 passes, elements 4 through N are never examined. Fine for logic, annoying for debugging "but this one should have passed!"
  • Same WIP caveat as _.all. If you need a robust, always-reliable boolean check, a plain comparison/condition node from the pack's logic helpers may serve you better than the underscore subsystem.
  • It pairs with _.all for the full picture. "All pass" vs "any pass" are complementary gates; the pack ships both as sibling nodes.
Categoryovum/underscore

Inputs (1)

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

Outputs (1)

NameTypeDescription
BOOLEANBOOLEAN