boolean
Converts the input to a boolean.
Type: transform
Aliases
toBoolean, bool, boolean, toBool
Parameters
- input (unknown): The input to convert to a boolean.
Returns
Type: boolean
The boolean value, or undefined for ambiguous string values.
Examples
javascript
toBoolean("true") // truejavascript
"false"|toBoolean // falsejavascript
toBoolean(1) // true