_.isBoolean
The properly-typed 'is this a bool?' check
- py_dict
- BOOLEAN
_.isBoolean answers "is this value a Python boolean?" and does it properly - with a real BOOLEAN output, the way the standard Underscore.js method was always meant to work. This is the one to use from this family, and it's worth a sentence on why: it's the exact same check as the pack's _.isBool (the port literally aliases isBool = isBoolean), but because isBoolean is a classic Underscore.js method, the auto-generator recognized it and gave it a typed socket. Same answer, cleaner plumbing.
How it works
The check is deliberately exact:
def isBoolean(self):
return self._wrap(type(self.obj) is bool)
type(...) is bool - not isinstance. So True and False pass, while 1, 1.0, and "true" all fail, even though Python treats 1 == True and many truthy things loosely. If you need "is this literally a boolean," this is precise; if you need "is it truthy," that's a different node.
The inputs that matter
- py_dict - the primary input (
*). Don't let the name throw you: the generator categorizedisBooleanas an object method, so the socket got calledpy_dict. It's just a bucket for whatever value you're inspecting, and it also accepts a_.CHAINto continue chaining.
Output is a single BOOLEAN - typed, and ready to drive a conditional branch directly.
Where you'd actually use it
The practical angle is defensiveness. ComfyUI is full of nodes that can hand you either a real bool or a string "true" depending on how a widget was wired - environment variables, settings readouts, combo values that resolve to text. Before you feed something into an if/else or a toggle, a _.isBoolean guard (or its sibling _.isDict, _.isCallable family members) tells you what you actually got. It's a debugging-and-data-quality node more than a pipeline workhorse.
Installing
Part of comfy-ovum (MIT). ComfyUI Manager → search comfy-ovum → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum
Underscore nodes run on the bundled underscore3 port - no extra install. Pack-wide requirements.txt includes pymediainfo (wants system libmediainfo on Linux), tomli-w, requests, braceexpand, pillow, numpy, markdown-it-py, aiohttp.
Gotchas
Two small notes. First, feeding it a _.CHAIN returns the chain instead of the boolean - that's the chaining contract, not a bug. Second, the usual pack-level caveat: the README stamps the underscore family as WIP and not production-ready. For a type guard this small and exact, that's mostly a formality - but keep it in a debug graph you don't depend on, and you'll be fine.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| py_dictopt | * | Primary input object (expected object). You can still pass any JSON-serializable value. Also accepts _.CHAIN to continue chaining. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |