Skip to main content

$$boolean

Evaluates input to boolean using the Truthy logic

Usage​

{ 
"$$boolean": /* input */,
"style": "JAVA" /* or JS */
}
"$$boolean([style]):{input}"
note

Concrete values in the usage example are default values.

Strings evaluation depends on style argument:

  • By default, value must be "true" for true.
  • Unless style is set to JS, then any non-empty value is true. Arrays and objects of size 0 returns false.

Returns​

boolean

Arguments​

ArgumentTypeValuesRequired / Default ValueDescription
Primaryanynull
styleenumJAVA/ JSJAVAStyle of considering truthy values (JS only relates to string handling; not objects and arrays)

Examples​

Input

Definition

Output

true
"$$boolean:$"
true
"0"
"$$boolean(js):$"
true
"false"
"$$boolean(js):$"
true
"true"
"$$boolean:$"
true
"True"
"$$boolean:$"
true
"true"
"$$boolean(JS):$"
true
1
"$$boolean:$"
true
-1
"$$boolean:$"
true
{
"": 0
}
"$$boolean:$"
true
[
0
]
"$$boolean:$"
true
false
"$$boolean:$"
false
""
"$$boolean:$"
false
""
"$$boolean(js):$"
false
"0"
"$$boolean:$"
false
"false"
"$$boolean:$"
false
"False"
"$$boolean:$"
false
0
"$$boolean:$"
false
null
"$$boolean:$"
false
{}
"$$boolean:$"
false
[]
"$$boolean:$"
false
"true"
{
"$$boolean": "$",
"style": "JS"
}
true
"false"
{
"$$boolean": "$",
"style": "js"
}
true
"false"
{
"$$boolean": "$"
}
false