none

Test whether all elements in an array are falsy.

Usage

var none = require( '@stdlib/array/base/none' );

none( x )

Tests whether all elements in an array are falsy.

var x = [ 0, 0, 0, 0 ];

var bool = none( x );
// returns true

Notes

  • If provided an empty array, the function returns true.
  • The function does not skip undefined elements and is thus not optimized for sparse arrays.

Examples

var bernoulli = require( '@stdlib/random/array/bernoulli' );
var none = require( '@stdlib/array/base/none' );

var x = bernoulli( 10, 0.1, {
    'dtype': 'int8'
});
// returns <Int8Array>

var out = none( x );
// returns <boolean>
Did you find this page helpful?