Class: Boolean

mindsmine. Boolean

A collection of useful static methods to deal with JavaScript booleans.


new Boolean()

Since:
  • 1.0.0

Methods


<static> getNullSafe(bool)

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:

 var bool1 = true;
 var bool2 = null;

 var bool3 = mindsmine.Boolean.getNullSafe(bool1);

 var bool4 = mindsmine.Boolean.getNullSafe(bool2);

 // bool3 now contains the boolean: true
 // bool4 now contains the boolean: false
Parameters:
Name Type Description
bool Boolean

The boolean to safeguard against null.

Since:
  • 1.0.0
Returns:

If bool is null then false.

Type
Boolean