DiviArea.Utils.toBool(value, undefinedValue)
Utility that tests, if a value equals to boolean true.
See below for a list of values that are considered true or false.
Params
value
- The value which should be converted to a boolean value.
undefinedValue
- A boolean value to assign if the test value is
undefined
.
Default: <code>true</code>
Returns
Either boolean true
or false
.
Notes
The following values are considered true:
true
1
- string starting with
y
(likeyes
) - string starting with
t
(liketrue
) - the string
on
The following values are considered false:
false
0
- string starting with
n
(likeno
) - string starting with
f
(likefalse
) - the string
off
If the value is undefined
the parameter undefinedValue
is returned.
Any other value is type-casted to boolean by JavaScript.