A collection of useful static methods to deal with JavaScript booleans.
- Since:
- 1.0.0
Methods
(static) getNullSafe(bool) → {Boolean}
Returns a non-null boolean, even if the object being passed is a null boolean.
If the passed-in object is a non-null boolean, then it is returned as-is.
Example usage:
mindsmine.Boolean.getNullSafe(null) // false
mindsmine.Boolean.getNullSafe(undefined) // false
mindsmine.Boolean.getNullSafe(NaN) // false
mindsmine.Boolean.getNullSafe(100) // false
mindsmine.Boolean.getNullSafe("") // false
mindsmine.Boolean.getNullSafe("hello") // false
mindsmine.Boolean.getNullSafe(true) // true
Parameters:
Name | Type | Description |
---|---|---|
bool |
Boolean | The boolean to safeguard against |
- Since:
- 1.0.0
Returns:
If bool is null
then false
.
- Type
- Boolean