Skip to content

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.

T

T

The value to convert.

boolean | T

bool('true'); // true
bool('false'); // false
bool('none'); // 'none'
bool(1); // 1