ish.type.bool

Boolean-based type functionality.

Source:

Methods

ish.type.bool.is(x, bAllowStringopt) → {boolean}

Source:
Determines if the passed value represents a boolean.
Parameters:
Name Type Attributes Default Description
x variant Value to interrogate.
bAllowString boolean <optional>
false Value representing if strings are to be considered valid.
Returns:
Type Description
boolean Value representing if the passed value represents a boolean.

ish.type.bool.is.tristate(x, bAllowStringopt) → {boolean}

Source:
See:
Determines if the passed value represents a tristate boolean (e.g. true, false or 'unknown' as represented by null or undefined).
Parameters:
Name Type Attributes Default Description
x variant Value to interrogate.
bAllowString boolean <optional>
false Value representing if strings are to be considered valid.
Returns:
Type Description
boolean Value representing if the passed value represents a tristate boolean.

ish.type.bool.is.true(x) → {boolean}

Source:
Determines if the passed value represents true.
Note: Values interpreted as true are: true, "true" (case-insensitive and trimmed) and non-0 integers.
Parameters:
Name Type Description
x variant Value to interrogate.
Returns:
Type Description
boolean Value representing if the passed value represents true.

ish.type.bool.mk(x, vDefaultValopt) → {boolean}

Source:
Casts the passed value into a boolean.
Parameters:
Name Type Attributes Default Description
x variant Value to interrogate.
vDefaultVal variant <optional>
truthy_value_of_x Value representing the default return value if casting fails.
Returns:
Type Description
boolean Value representing the passed value as a boolean type.

[mixin] ish.type.bool.mk.fuzzy(x, vDefaultValopt, a_sTruthyopt, a_sFalsyopt) → {boolean}

Source:
See:
Casts the passed value into a boolean based on language.
From Mixin: ish.type-ex.js must be included for ishJS to access this functionality.
Parameters:
Name Type Attributes Default Description
x variant Value to interrogate.
vDefaultVal variant <optional>
Value representing the default return value if casting fails.
a_sTruthy Array.<string> <optional>
['1','true','yes','on'] Value representing the lowercase strings to interpret as `true` values.
a_sFalsy Array.<string> <optional>
['0','false','no','off'] Value representing the lowercase strings to interpret as `false` values.
Returns:
Type Description
boolean Value representing the passed value as a boolean type.