ComfyUI Node

IsNoneOrEmpty

IsNoneOrEmpty – ComfyUI Node

By lldacing·Created 3 years ago·Updated 8 months ago· 96
IsNoneOrEmpty
  • any
  • boolean

What it is

IsNoneOrEmpty is a single, honest question asked of whatever you plug into it: is this thing actually empty? Not just None - the README's own description is specific that it covers None, an empty list, an empty (trimmed) string, and an empty dict, all in one check. That's a genuinely useful consolidation, because "is this thing usable" in a data-flowing workflow rarely means just checking for None - an empty string or an empty list is functionally just as "nothing there" as None is, and checking for all of them separately with generic logic nodes is tedious.

This is exactly the kind of guard node you want right after anything that might not have produced a result - a list filter that could come back empty, a JSON lookup for a key that might not exist, an optional field from an API response - before you let a workflow barrel ahead and crash three nodes later on a value that was never really there.

How it works

Checks the input against several kinds of "nothing," not just one. Worth noting specifically: for strings, it trims whitespace before judging emptiness - so a string that's just spaces counts as empty too, not as "technically non-empty because it has characters in it." That's a small detail but it matters if your data is coming from anywhere that might leave stray whitespace (form input, a loosely-formatted API field).

Inputs and outputs

One input: any (type *, required) - whatever you want to check.

One output: boolean (BOOLEAN) - true if the input is None, an empty list, an empty or whitespace-only string, or an empty dict; false otherwise.

Installing it

Ships with comfyui-easyapi-nodes. Through ComfyUI Manager: search "comfyui-easyapi-nodes", install, restart ComfyUI. Manual install:

cd ComfyUI/custom_nodes
git clone https://github.com/lldacing/comfyui-easyapi-nodes.git
cd comfyui-easyapi-nodes
pip install -r requirements.txt

No special dependency for this node itself, but run the requirements install so the rest of the pack works too. git pull in the folder to upgrade later.

Common issues

"It says something's empty and I'm sure it isn't." Double-check for the whitespace-trim behavior on strings - a string that looks non-empty visually but is actually just spaces or a stray newline will register as empty by this node's definition, correctly, even if that's surprising the first time you hit it.

"It says something's not empty and I expected it to register as empty." Make sure you're checking the actual value flowing through, not a container around it - a list containing one empty string ([""]) is not an empty list by this node's check, since the list itself has one element. If you need to check the contents rather than the container, you'd check the element directly, not the list.

"How is this different from just checking if a value is falsy in a general logic node?" A generic truthiness check in most logic nodes only handles None/boolean-style falsy checks reliably - this node specifically bundles the list/string/dict emptiness cases that a naive falsy check can miss depending on how the logic node is implemented. It's purpose-built for exactly the data shapes this pack's other nodes (lists, JSON objects, strings) tend to produce.

"I want a default value instead of just true/false when something's empty." That's IsNoneOrEmptyOptional - same emptiness check, but it returns a fallback value you provide instead of a boolean, which saves you a separate conditional branch.

CategoryEasyApi/Utils

Inputs (1)

NameTypeDefaultDescription
any*

Outputs (1)

NameTypeDescription
booleanBOOLEAN