_.hasCallable
Is that property actually a function? _.hasCallable
- obj
- *
_.hasCallable is a yes/no check with a twist: does the object have the given property and is that property callable? The docs call it a shortcut for checking "has a given property that is callable." In a graph that deals in functions - iteratees, callbacks, method handles - that's the difference between "the key exists" and "the key exists and I can call it."
It's one of the _.* nodes in sfinktah/comfy-ovum, the author's grab-bag pack, wrapping underscore3 (a Python port of Underscore.js). Display name _.hasCallable, class UnderscoreHasCallable.
The inputs that matter
- obj - the object to inspect (loose
*; also accepts a_.CHAIN). - key - the property name, a plain STRING widget.
Output is a loose *, though in practice it's a boolean - True if the key exists and holds a callable, False otherwise. It doesn't have the typed BOOLEAN output its sibling _.has does, so wire it accordingly.
The honest catch
Same family curse as _.has, inherited: the port checks callable(getattr(obj, key, None)), which is attribute-based. On a plain data dict, keys aren't attributes, so _.hasCallable will say False for dict keys regardless. It's meaningful for Python objects that genuinely carry methods - check whether an object has a callable run or value - but on the data structures ComfyUI mostly moves around, it's a False generator. Niche, and the niche is narrow.
Why you'd reach for it
The realistic scenario: you're poking at a live object and want to confirm you can actually invoke a method before wiring a call. Given the attribute-based behavior and how rarely a ComfyUI workflow carries real Python objects with methods, this is one of the least-used nodes in the family. Know it exists, don't build around it.
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
Family disclaimer applies with feeling. As with _.has, don't trust the description on dicts - verify against your actual data. And the chain rule: chain in, chain out, _.value to unwrap.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| objopt | * | Primary input object. Also accepts _.CHAIN to continue chaining. | |
| keyopt | STRING | key (string) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | — |