Nodes/comfy-ovum/_.forEach
ComfyUI Node

_.forEach

_.forEach, and what it's actually for

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

_.forEach iterates a list or object and yields each element to an iteratee - (value, index, list) for arrays, (value, key, list) for dicts. In JavaScript land that's how you run a side effect per item. The underscore port returns the original list afterwards so you can keep chaining. That's the contract.

It's one of the _.* nodes in sfinktah/comfy-ovum, the author's kitchen-sink pack, wrapping underscore3 (a Python port of Underscore.js). And it's the one where the family's unfinished state is most visible, because its entire purpose is the iteratee - and the node doesn't expose one.

The inputs that matter

  • obj - the collection to iterate (loose *; also accepts a _.CHAIN).

That's it. One input, one output. Output is a loose * - the original collection, returned unchanged so it can feed the next step of a chain.

The honest catch

Here's the thing: _.forEach without an iteratee is a no-op that echoes its input back. And the info schema for this node ships only obj - no iteratee input, no _json fallback, no function slot. So in its current state it's useful almost exclusively as a chain element: a named step in the middle of a _.chain pipeline that exists to be a place-holder or to trigger evaluation ordering, returning the list for the next method to consume. If you need real per-item work done, _.map (or any of the other map-family nodes) is where that lives - and even those need you to source a function from somewhere.

When you'd reach for it

Honestly? Rarely, today. If you're chaining and want the pipeline to pass the list through a node that visibly "visits" it, this is a zero-cost way to do it. If you're debugging, it at least tells you the collection passed through intact. But for actual per-item processing, look elsewhere in the pack.

Install

ComfyUI Manager, search "comfy-ovum", or:

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

Restart, under ovum/underscore. No models, no downloads.

Honest warnings

The README's family disclaimer: work in progress, "an absolute disaster to use in production" - _.forEach is Exhibit A. Don't expect per-element side effects you can observe from the graph yet. And the chain rule applies harder here: since it's designed to pass the collection through, feeding it a _.CHAIN means you'll get a chain back and must _.value it before the data's usable downstream.

Categoryovum/underscore

Inputs (1)

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

Outputs (1)

NameTypeDescription
**