Expressions and code
Boolean transformation methods in Duaer
In a Duaer expression, a boolean can be tested for empty and converted to a number or a string. true becomes 1 as a number; false becomes 0.
Methods
- isEmpty() returns true for false, null, or undefined, and false for true. It is not only a missing-field check.
- isNotEmpty() is the inverse of isEmpty().
- toNumber() turns true into 1 and false into 0.
- toString() turns the boolean into the string true or false.
{{ $json.active.toNumber() }}Questions
What does toNumber return in a Duaer expression?
In a Duaer expression, true becomes 1 and false becomes 0. toString() becomes the string true or false.
Does Duaer isEmpty treat false as empty?
Yes. In a Duaer expression, isEmpty() on a boolean returns true for false, null, or undefined, and false for true. It is not only a missing-field check.
In this section
Use data transformation methods in Duaer
In a Duaer expression, call a transformation method on a value, such as {{ $json.name.toTitleCase() }}. Methods are grouped by array, boolean, date, number, object, and string.
TransformNumber transformation methods in Duaer
In a Duaer expression, number methods round, test even or odd, and convert to a boolean, a string, or a DateTime. round goes to the nearest number; ceil goes up; floor goes down.
TransformString transformation methods in Duaer
In a Duaer expression, string methods change case, slice text, test emails and URLs, and encode or decode base64 and URLs.