0.2.2 • Published 5 months ago

@stdlib/assert-is-boolean v0.2.2

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
5 months ago

isBoolean

NPM version Build Status Coverage Status

Test if a value is a boolean.

Installation

npm install @stdlib/assert-is-boolean

Usage

var isBoolean = require( '@stdlib/assert-is-boolean' );

isBoolean( value )

Tests if a value is a boolean.

var Boolean = require( '@stdlib/boolean-ctor' );

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

isBoolean.isPrimitive( value )

Tests if a value is a primitive boolean.

var Boolean = require( '@stdlib/boolean-ctor' );

var bool = isBoolean.isPrimitive( true );
// returns true

bool = isBoolean.isPrimitive( false );
// returns true

bool = isBoolean.isPrimitive( new Boolean( true ) );
// returns false

isBoolean.isObject( value )

Tests if a value is a Boolean object.

var Boolean = require( '@stdlib/boolean-ctor' );

var bool = isBoolean.isObject( true );
// returns false

bool = isBoolean.isObject( new Boolean( false ) );
// returns true

Examples

var Boolean = require( '@stdlib/boolean-ctor' );
var isBoolean = require( '@stdlib/assert-is-boolean' );

var bool = isBoolean( false );
// returns true

bool = isBoolean( new Boolean( false ) );
// returns true

bool = isBoolean( 'true' );
// returns false

bool = isBoolean( null );
// returns false

Notice

This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.

For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.

Community

Chat


License

See LICENSE.

Copyright

Copyright © 2016-2024. The Stdlib Authors.

@infinitebrahmanuniverse/nolb-_stdlib_a@everything-registry/sub-chunk-867@stdlib/ndarray-iter-matrix-entries@stdlib/array-base-count-same-value@stdlib/array-base-count-same-value-zero@stdlib/array-index@stdlib/array-linspace@stdlib/array-min-dtype@stdlib/array-bool@stdlib/array-to-fancy@stdlib/bench-harness@stdlib/utils-merge@stdlib/utils-timeit@stdlib/utils-pluck@stdlib/utils-object-inverse@stdlib/utils-object-inverse-by@stdlib/utils-parallel@stdlib/streams-node-from-iterator@stdlib/streams-node-from-strided-array@stdlib/streams-node-inspect@stdlib/streams-node-inspect-sink@stdlib/streams-node-join@stdlib/streams-node-split@stdlib/streams-node-transform@stdlib/streams-node-debug@stdlib/streams-node-debug-sink@stdlib/streams-node-empty@stdlib/streams-node-from-array@stdlib/streams-node-from-circular-array@stdlib/streams-node-from-constant@stdlib/stats-kstest@stdlib/stats-levene-test@stdlib/stats-lowess@stdlib/stats-pcorrtest@stdlib/stats-ttest@stdlib/stats-ttest2@stdlib/stats-vartest@stdlib/stats-wilcoxon@stdlib/stats-ztest@stdlib/stats-ztest2@stdlib/stats-kruskal-test@stdlib/ndarray-iter-column-entries@stdlib/ndarray-iter-columns@stdlib/ndarray-iter-matrices@stdlib/ndarray-slice@stdlib/ndarray-slice-assign@stdlib/ndarray-slice-dimension@stdlib/ndarray-slice-dimension-from@stdlib/ndarray-slice-dimension-to@stdlib/ndarray-slice-from@stdlib/ndarray-slice-to@stdlib/net-disposable-http-server@stdlib/ndarray-ctor@stdlib/ndarray-min-dtype@stdlib/ndarray-iter-row-entries@stdlib/ndarray-iter-rows@stdlib/stats-binomial-test@stdlib/stats-chi2gof@stdlib/stats-chi2test@stdlib/stats-fligner-test@stdlib/regexp-whitespace@stdlib/repl-presentation@stdlib/simulate-iter-awgn@stdlib/simulate-iter-awln@stdlib/simulate-iter-awun@stdlib/stats-anova1@stdlib/stats-bartlett-test@stdlib/slice-seq2slice@stdlib/stats-incr-grubbs@stdlib/stats-incr-mgrubbs@stdlib/assert-is-boolean-array@stdlib/assert-is-boxed-primitive@stdlib/random-base-gamma@stdlib/random-base-improved-ziggurat@stdlib/random-base-minstd@stdlib/random-base-minstd-shuffle@stdlib/random-base-mt19937@stdlib/random-base-negative-binomial@stdlib/random-base-randi@stdlib/random-base-randn@stdlib/random-base-randu@stdlib/random-base-t@stdlib/random-base-beta@stdlib/random-base-box-muller@stdlib/random-sample@stdlib/random-iter-minstd@stdlib/random-iter-minstd-shuffle@stdlib/random-iter-mt19937@stdlib/utils-async-inmap@stdlib/utils-async-inmap-right@stdlib/utils-async-map-function@stdlib/utils-async-map-keys@stdlib/utils-async-map-values@stdlib/utils-async-none-by@stdlib/utils-async-none-by-right@stdlib/utils-async-reduce@stdlib/utils-async-reduce-right@stdlib/utils-async-some-by@stdlib/utils-async-some-by-right@stdlib/utils-async-tabulate-by
0.2.2

5 months ago

0.2.1

10 months ago

0.2.0

10 months ago

0.1.0

1 year ago

0.1.1

1 year ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago