Nodes/comfy-ovum/_.isString
ComfyUI Node

_.isString

Tell text from everything else before your format node eats it.

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

"String or list?" is a classic Comfy failure mode. A widget reader gives you a string when you expected a number, a metadata extractor gives you a list when you wanted text, and suddenly your format node is rendering ['a', 'b'] into a prompt and wondering why the output looks cursed. _.isString is the boring, reliable answer: a boolean test for "is this actually str?"

What it is

It's part of the ovum/underscore family inside sfinktah/comfy-ovum, the pack's collection of graph wrappers around underscore3, a Python port of Underscore.js. This node wraps the isString check, which in Python 3 is simply type(obj) is str. If you've seen _.isUnicode in the same menu, that's the same test - in Python 3 every string is unicode, so the two nodes are interchangeable. Pick whichever reads better to you and ignore the other.

How it works

One optional input, and here's the first thing that'll make you blink: it's named py_dict. Don't read anything into the name. The generator that builds these nodes groups every is* method under an "object" category and labels the primary input py_dict as a default, even though the tooltip tells you the truth - you can pass any JSON-serializable value. So a string, a number, a list, whatever. It accepts everything and answers "was this a string?"

The output is one of the few in the family that's properly typed BOOLEAN - the generator's whitelist includes isString, so downstream boolean sockets accept it directly. That's a nice change from most of the is* nodes, which come out typed * (ANY) and need a cast. Feed it a _.CHAIN instead of a plain value and it returns a chain to keep going, with the real result pulled out by _.value.

Where you'd use it

Branching, mostly. A conditional that checks _.isString before deciding whether to feed a value to a text node or a list node. Guarding a Python String Format node so it never receives a list it'll stringify weirdly. Or just debugging - wire it into a preview and confirm what type that mystery * socket is actually carrying.

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 handful of small dependencies. One caveat worth keeping in mind: the README itself labels the underscore family a work in progress, so treat these as handy helpers in your own graphs rather than the foundation of a shared workflow.

Categoryovum/underscore

Inputs (1)

NameTypeDefaultDescription
py_dictopt*Primary input object (expected object). You can still pass any JSON-serializable value. Also accepts _.CHAIN to continue chaining.

Outputs (1)

NameTypeDescription
BOOLEANBOOLEAN