diff --git a/lib/node_modules/@stdlib/array/base/none/lib/main.js b/lib/node_modules/@stdlib/array/base/none/lib/main.js index fbe9c7682343..07d33115ea90 100644 --- a/lib/node_modules/@stdlib/array/base/none/lib/main.js +++ b/lib/node_modules/@stdlib/array/base/none/lib/main.js @@ -22,9 +22,11 @@ var isComplex128Array = require( '@stdlib/array/base/assert/is-complex128array' ); var isComplex64Array = require( '@stdlib/array/base/assert/is-complex64array' ); +var isBooleanArray = require( '@stdlib/array/base/assert/is-booleanarray' ); var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); var reinterpret128 = require( '@stdlib/strided/base/reinterpret-complex128' ); var reinterpret64 = require( '@stdlib/strided/base/reinterpret-complex64' ); +var reinterpretBoolean = require( '@stdlib/strided/base/reinterpret-boolean' ); // FUNCTIONS // @@ -130,6 +132,10 @@ function none( x ) { if ( isComplex64Array( x ) ) { return internal( reinterpret64( x, 0 ) ); } + // If provided a boolean array, reinterpret as a typed array and test whether all elements are false... + if ( isBooleanArray( x ) ) { + return internal( reinterpretBoolean( x, 0 ) ); + } return accessors( obj ); } return internal( x ); diff --git a/lib/node_modules/@stdlib/array/base/none/test/test.js b/lib/node_modules/@stdlib/array/base/none/test/test.js index 0660413bf5fa..ff7121e1d517 100644 --- a/lib/node_modules/@stdlib/array/base/none/test/test.js +++ b/lib/node_modules/@stdlib/array/base/none/test/test.js @@ -25,6 +25,7 @@ var AccessorArray = require( '@stdlib/array/base/accessor' ); var Float64Array = require( '@stdlib/array/float64' ); var Complex64Array = require( '@stdlib/array/complex64' ); var Complex128Array = require( '@stdlib/array/complex128' ); +var BooleanArray = require( '@stdlib/array/bool' ); var none = require( './../lib' ); @@ -74,6 +75,17 @@ tape( 'if provided an empty collection, the function returns `true` (complex typ t.end(); }); +tape( 'if provided an empty collection, the function returns `true` (boolean array)', function test( t ) { + var out; + var arr; + + arr = new BooleanArray( [] ); + out = none( arr ); + + t.strictEqual( out, true, 'returns expected value' ); + t.end(); +}); + tape( 'if provided an empty collection, the function returns `true` (accessor)', function test( t ) { var out; var arr; @@ -107,7 +119,7 @@ tape( 'the function returns `true` if all elements are falsy (real typed array)' t.end(); }); -tape( 'the function returns `true` if all elements are falsy (real typed array)', function test( t ) { +tape( 'the function returns `true` if all elements are falsy (complex typed array)', function test( t ) { var out; var arr; @@ -123,6 +135,17 @@ tape( 'the function returns `true` if all elements are falsy (real typed array)' t.end(); }); +tape( 'the function returns `true` if all elements are falsy (boolean array)', function test( t ) { + var out; + var arr; + + arr = new BooleanArray( [ false, false, false, false ] ); + out = none( arr ); + + t.strictEqual( out, true, 'returns expected value' ); + t.end(); +}); + tape( 'the function returns `true` if all elements are falsy (accessor)', function test( t ) { var out; var arr; @@ -188,6 +211,17 @@ tape( 'the function returns `false` if one or more elements are truthy (complex t.end(); }); +tape( 'the function returns `false` if one or more elements are truthy (boolean array)', function test( t ) { + var out; + var arr; + + arr = new BooleanArray( [ false, true, false, false ] ); + out = none( arr ); + + t.strictEqual( out, false, 'returns expected value' ); + t.end(); +}); + tape( 'the function returns `false` if one or more elements are truthy (accessor)', function test( t ) { var out; var arr;