ComfyUI Node

_.join

Turn a list into one string, JavaScript style — glue included.

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

You've got a list of tags, filenames, or prompt fragments and you want one clean string out of it. That's _.join: the JavaScript Array.join brought to Comfy, where every element gets coerced to text and glued together with a separator you choose. Simple, and surprisingly easy to reach for once you're juggling lists.

What it is

One node in the ovum/underscore family inside sfinktah/comfy-ovum, wrapping the join method of underscore3, a Python port of Underscore.js. The implementation is a one-liner: glue.join(str(x) for x in obj). Every element is stringified, then joined. Nothing clever, nothing destructive - the input list isn't touched.

Inputs that matter

Two of them, and both are simple:

  • obj (type *) - the list (or any iterable) to join.
  • glue (STRING, default " ") - the separator placed between elements.

That default is worth a moment. Python's ",".join uses a comma, JavaScript's Array.join uses a comma, but this port defaults to a single space. Fine for building a sentence or a spaced tag list, but if you expected comma-separated output you'll wonder why nothing's separating. Set glue to ", " for tags or "/" for paths.

The output is one string, though it's typed * (ANY) rather than STRING - the generator didn't stamp this one, so a strict string socket might want a cast. Feed it a _.CHAIN and you get a chain back instead, resolved later with _.value.

Where it shines

Prompt fragments are the obvious one: build a list of style tags upstream, join them into a single prompt line. Filenames are another - combine a base name, counter, and extension into one path without a pile of concat nodes. And if you pair it with _.map, you can transform a list of dicts into a list of strings and then join that into a summary line.

The gotcha

Because everything gets str()-coerced, a dict element becomes its Python repr - {'a': 1} - which is almost never the label you wanted. Numbers become text happily (42"42"), but keep the input list to strings and simple scalars unless you enjoy debugging repr noise. Also, if you just want a join without the underscore machinery, the same pack has a plain List Join node in its Pystructure family; _.join is the variant that plays with chains and iteratees.

Installing comfy-ovum

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

cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum
pip install -r comfy-ovum/requirements.txt

Restart and you're done. No model downloads, no CUDA - pure-Python utilities with a few small dependencies. Family caveat stands: the README calls these nodes a work in progress, though _.join is about as low-risk as this family gets.

Categoryovum/underscore

Inputs (2)

NameTypeDefaultDescription
objopt*Primary input object. Also accepts _.CHAIN to continue chaining.
glueoptSTRING glue (string)

Outputs (1)

NameTypeDescription
**