Test if a value is a boolean.
var isBoolean = require( '@stdlib/utils/is-boolean' );
Tests if a value
is a boolean
.
var bool = isBoolean( false );
// returns true
bool = isBoolean( true );
// returns true
bool = isBoolean( new Boolean( false ) );
// returns true
bool = isBoolean( new Boolean( true ) );
// returns true
Tests if a value
is a primitive boolean
.
var bool = isBoolean.isPrimitive( true );
// returns true
bool = isBoolean.isPrimitive( false );
// returns true
bool = isBoolean.isPrimitive( new Boolean( true ) );
// returns false
Tests if a value
is a Boolean
object.
var bool = isBoolean.isObject( true );
// returns false
bool = isBoolean.isObject( new Boolean( false ) );
// returns true
Tests if a value
is a boolean array
.
var bool = isBoolean.isBooleanArray( [ true, new Boolean(false) ] );
// returns true
bool = isBoolean.isBooleanArray( [ true, 'true' ] );
// returns false
Tests if a value
is a primitive boolean array
.
var bool = isBoolean.isPrimitiveBooleanArray( [ true, false ] );
// returns true
bool = isBoolean.isPrimitiveBooleanArray( [ true, new Boolean(true) ] );
// returns false
var isBoolean = require( '@stdlib/utils/is-boolean' );
console.log( isBoolean( false ) );
// returns true
console.log( isBoolean( new Boolean( false ) ) );
// returns true
console.log( isBoolean( 'true' ) );
// returns false
console.log( isBoolean( null ) );
// returns false