Is Empty#
The Is Empty converter inspects the input value and reports whether it qualifies as empty. The Result Type setting controls whether the converter outputs a boolean flag or passes the input value through. The converter treats a value as empty when it is one of the following:
- A string that is blank, whitespace-only,
{}, or[]. - An array with no items.
- An object with no properties.
- An object whose only property is
$id.
The converter reports all other values as not empty, including numbers, booleans, dates, null, and undefined.
Settings#
| Name | Data Type | Possible Values | Description |
|---|---|---|---|
| resultType | Enum | BooleanNullOrValue | Controls the output. Boolean returns true when the input is empty and false otherwise. NullOrValue returns undefined when the input is empty and passes the input value through otherwise. Default is Boolean. |
Table 1: Settings
Examples#
Boolean Result#
| Input | Output |
|---|---|
"" | true |
" " | true |
"{}" | true |
"[]" | true |
"hello" | false |
[] | true |
[1, 2, 3] | false |
{} | true |
{ "$id": "123" } | true |
{ "$id": "123", "name": "x" } | false |
| A Date value | false |
null | false |
42 | false |
Table 2: Examples with the Boolean result type
NullOrValue Result#
| Input | Output |
|---|---|
"" | undefined |
"{}" | undefined |
"[]" | undefined |
[] | undefined |
["a"] | ["a"] |
"hello" | "hello" |
Table 3: Examples with the NullOrValue result type
Failure Behavior#
This converter never fails. See Converters for the full set of failure patterns across converters.
