diff --git a/lib/node_modules/@stdlib/array/base/every/lib/main.js b/lib/node_modules/@stdlib/array/base/every/lib/main.js index 7808cdaa923a..240043614234 100644 --- a/lib/node_modules/@stdlib/array/base/every/lib/main.js +++ b/lib/node_modules/@stdlib/array/base/every/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 // @@ -165,6 +167,10 @@ function every( x ) { if ( isComplex64Array( x ) ) { return internalComplex( reinterpret64( x, 0 ) ); } + // If provided a boolean array, reinterpret as a typed array and test each element... + if ( isBooleanArray( x ) ) { + return internal( reinterpretBoolean( x, 0 ) ); + } return accessors( obj ); } return internal( x ); diff --git a/lib/node_modules/@stdlib/array/base/every/test/test.js b/lib/node_modules/@stdlib/array/base/every/test/test.js index a39b8773dfff..5a0f04ce3d4e 100644 --- a/lib/node_modules/@stdlib/array/base/every/test/test.js +++ b/lib/node_modules/@stdlib/array/base/every/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 every = 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 = every( 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 truthy (real typed array) t.end(); }); -tape( 'the function returns `true` if all elements are truthy (real typed array)', function test( t ) { +tape( 'the function returns `true` if all elements are truthy (complex typed array)', function test( t ) { var out; var arr; @@ -123,6 +135,17 @@ tape( 'the function returns `true` if all elements are truthy (real typed array) t.end(); }); +tape( 'the function returns `true` if all elements are truthy (boolean array)', function test( t ) { + var out; + var arr; + + arr = new BooleanArray( [ true, true, true, true ] ); + out = every( arr ); + + t.strictEqual( out, true, 'returns expected value' ); + t.end(); +}); + tape( 'the function returns `true` if all elements are truthy (accessor)', function test( t ) { var out; var arr; @@ -188,6 +211,17 @@ tape( 'the function returns `false` if one or more elements are falsy (complex t t.end(); }); +tape( 'the function returns `false` if one or more elements are falsy (boolean array)', function test( t ) { + var out; + var arr; + + arr = new BooleanArray( [ true, false, false, true ] ); + out = every( arr ); + + t.strictEqual( out, false, 'returns expected value' ); + t.end(); +}); + tape( 'the function returns `false` if one or more elements are falsy (accessor)', function test( t ) { var out; var arr;