bool
bool<
T>(value):boolean|T
Defined in: core/utils/convert.ts:17
Converts the strings 'true' and 'false' into booleans.
Any other value, including other strings, is returned unchanged. Used to
read boolean options out of data-* attributes, which are always strings.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”T
The value to convert.
Returns
Section titled “Returns”boolean | T
Example
Section titled “Example”bool('true'); // truebool('false'); // falsebool('none'); // 'none'bool(1); // 1