toBoolean
Converts any value to a Boolean equivalent.
Note: If no user-defined array is passed, the default true values are:
['true', 'yes', 'y', '1'].
Parameters
val
any value to check if true or falsetrueValuesArr
array of user defined true values (optional, defaulttrue,'true','yes','y','1',1
)
Examples
toBoolean('y');
// => true
toBoolean(null);
// => false
Returns boolean equivalent of the value.
Meta
- version: 3.1.1
- Source: to-boolean.ts