diff --git a/lib/node_modules/@stdlib/array/base/cuany/README.md b/lib/node_modules/@stdlib/array/base/cuany/README.md new file mode 100644 index 000000000000..39053f03339f --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/cuany/README.md @@ -0,0 +1,114 @@ + + +# cuany + +> Cumulatively test whether at least one element in a provided array is truthy. + +
+ +## Usage + +```javascript +var cuany = require( '@stdlib/array/base/cuany' ); +``` + +#### cuany( x ) + +Cumulatively tests whether at least one element in a provided array is truthy. + +```javascript +var x = [ false, false, true, false, false ]; + +var y = cuany( x ); +// returns [ false, false, true, true, true ]; +``` + +#### cuany.assign( x, out, stride, offset ) + +Cumulatively tests whether at least one element in a provided array is truthy and assigns results to a provided output array. + +```javascript +var x = [ false, false, true, false, false ]; +var y = [ false, null, false, null, false, null, false, null, false, null ]; + +var out = cuany.assign( x, y, 2, 0 ); +// returns [ false, null, false, null, true, null, true, null, true, null ] + +var bool = ( out === y ); +// returns true +``` + +The function supports the following parameters: + +- **x**: input array. +- **out**: output array. +- **stride**: output array stride. +- **offset**: output array offset. + +
+ + + +
+ +
+ + + +
+ +## Examples + + + +```javascript +var bernoulli = require( '@stdlib/random/array/bernoulli' ); +var cuany = require( '@stdlib/array/base/cuany' ); + +// Create an array of random values: +var x = bernoulli( 10, 0.1 ); +console.log( x ); + +// Cumulatively determine whether values are truthy: +var out = cuany( x ); +console.log( out ); +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/array/base/cuany/benchmark/benchmark.assign.length.js b/lib/node_modules/@stdlib/array/base/cuany/benchmark/benchmark.assign.length.js new file mode 100644 index 000000000000..7e73c55e3b08 --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/cuany/benchmark/benchmark.assign.length.js @@ -0,0 +1,98 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var isArray = require( '@stdlib/assert/is-array' ); +var filled = require('@stdlib/array/base/filled'); +var pkg = require( './../package.json' ).name; +var cuany = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var x = filled( 1.5, len ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var y; + var v; + var i; + + y = filled( false, len ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = cuany.assign( x, y, 1, 0 ); + if ( typeof v !== 'object' ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isArray( v ) ) { + b.fail( 'should return an array' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':assign:len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/array/base/cuany/benchmark/benchmark.js b/lib/node_modules/@stdlib/array/base/cuany/benchmark/benchmark.js new file mode 100644 index 000000000000..f0ba84437570 --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/cuany/benchmark/benchmark.js @@ -0,0 +1,51 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isArray = require( '@stdlib/assert/is-array' ); +var pkg = require( './../package.json' ).name; +var cuany = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var x; + var i; + var v; + + x = [ false, false, true, false, false ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = cuany( x ); + if ( typeof v !== 'object' ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isArray( v ) ) { + b.fail( 'should return an array' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/array/base/cuany/benchmark/benchmark.length.js b/lib/node_modules/@stdlib/array/base/cuany/benchmark/benchmark.length.js new file mode 100644 index 000000000000..55e3f7c124ea --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/cuany/benchmark/benchmark.length.js @@ -0,0 +1,95 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var isArray = require( '@stdlib/assert/is-array' ); +var filled = require('@stdlib/array/base/filled'); +var pkg = require( './../package.json' ).name; +var cuany = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var x = filled( 1.5, len ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var v; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = cuany( x ); + if ( typeof v !== 'object' ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isArray( v ) ) { + b.fail( 'should return an array' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/array/base/cuany/docs/repl.txt b/lib/node_modules/@stdlib/array/base/cuany/docs/repl.txt new file mode 100644 index 000000000000..4af964dc004e --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/cuany/docs/repl.txt @@ -0,0 +1,55 @@ + +{{alias}}( x ) + Cumulatively tests whether at least one element in a provided array is + truthy. + + Parameters + ---------- + x: ArrayLikeObject + Input array. + + Returns + ------- + out: Array + Output array. + + Examples + -------- + > var x = [ false, false, true, false, false ]; + > var y = {{alias}}( x ) + [ false, false, true, true, true ] + + +{{alias}}.assign( x, y, stride, offset ) + Cumulatively tests whether at least one element in an array is truthy and + assigns results to provided output array. + + Parameters + ---------- + x: ArrayLikeObject + Input array. + + y: ArrayLikeObject + Output array. + + stride: integer + Output array stride. + + offset: integer + Output array offset. + + Returns + ------- + y: ArrayLikeObject + Output array. + + Examples + -------- + > var x = [ false, false, true, false, false ]; + > var y = [ false, null, false, null, false, null, false, null, false ]; + > var result = {{alias}}.assign( x, y, 2, 0 ) + [ false, null, false, null, true, null, true, null, true ]; + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/array/base/cuany/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/base/cuany/docs/types/index.d.ts new file mode 100644 index 000000000000..36f51d8026c2 --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/cuany/docs/types/index.d.ts @@ -0,0 +1,86 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Collection, AccessorArrayLike } from '@stdlib/types/array'; + +/** +* Interface describing `cuany`. +*/ +interface CuAny { + /** + * Cumulatively tests whether at least one element in a provided array is truthy. + * + * @param x - input array + * @returns output array + * + * @example + * var x = [ false, false , true, false , false ]; + * + * var y = cuany( x ); + * // returns [ false, false, true, true, true ]; + */ + ( x: Collection | AccessorArrayLike ): Array; + + /** + * Cumulatively tests whether at least one element in an array is truthy and assigns the results to a provided output array. + * + * @param x - input array + * @param y - output array + * @param stride - output array stride + * @param offset - output array offset + * @returns output array + * + * @example + * var x = [ false, false, true, false, false ]; + * var y = [ false, null, false, null, false, null, false, null, false, null ]; + * + * var arr = cuany.assign( x, y, 2, 0 );, + * // returns [ false, null, false, null, true, null, true, null, true, null ]; + */ + assign | AccessorArrayLike>( x: Collection | AccessorArrayLike, y: U, stride: number, offset: number ): U; +} + +/** +* Cumulatively tests whether at least one element in a provided array is truthy. +* +* @param x - input array +* @returns output array +* +* @example +* var x = [ false, false, true, false, false ]; +* +* var result = cuany( x ); +* // returns [ false, false, true, true, true ] +* +* @example +* var x = [ false, false, true, false, false ]; +* var y = [ false, null, false, null, false, null, false, null, false, null ]; + +* var arr = cuany.assign( x, y, 2, 0 ); +* // returns [ false, null, false, null, true, null, true, null, true, null ] +*/ +declare var cuany: CuAny; + + +// EXPORTS // + +export = cuany; diff --git a/lib/node_modules/@stdlib/array/base/cuany/docs/types/test.ts b/lib/node_modules/@stdlib/array/base/cuany/docs/types/test.ts new file mode 100644 index 000000000000..dc338cb9bb1a --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/cuany/docs/types/test.ts @@ -0,0 +1,115 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +import cuany = require( './index' ); + + +// TESTS // + +// The function returns an array... +{ + cuany( [ false, false, true, false, false ] ); // $ExpectType boolean[] + cuany( [ false, false, true, false, false ] ); // $ExpectType boolean[] +} + +// The compiler throws an error if the function is provided a first argument which is not an array-like object... +{ + cuany( 1 ); // $ExpectError + cuany( true ); // $ExpectError + cuany( false ); // $ExpectError + cuany( null ); // $ExpectError + cuany( void 0 ); // $ExpectError + cuany( {} ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + cuany(); // $ExpectError + cuany( [], [] ); // $ExpectError +} + +// Attached to the main export is an `assign` method which returns a collection... +{ + const x = [ false, false, true, false, false ]; + const y = [ false, null, false, null, false, null, false, null, false, null ]; + + cuany.assign( x, y, 2, 0 ); // $ExpectType (boolean | null)[] +} + +// The compiler throws an error if the `assign` method is provided a first argument which is not an array-like object... +{ + const x = [ false, false, true, false, false ]; + + cuany.assign( 1, x, 2, 0 ); // $ExpectError + cuany.assign( true, x, 2, 0 ); // $ExpectError + cuany.assign( false, x, 2, 0 ); // $ExpectError + cuany.assign( null, x, 2, 0 ); // $ExpectError + cuany.assign( void 0, x, 2, 0 ); // $ExpectError + cuany.assign( {}, x, 2, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a second argument which is not an array-like object... +{ + const x = [ false, false, true, false, false ]; + + cuany.assign( x, 1, 2, 0 ); // $ExpectError + cuany.assign( x, true, 2, 0 ); // $ExpectError + cuany.assign( x, false, 2, 0 ); // $ExpectError + cuany.assign( x, null, 2, 0 ); // $ExpectError + cuany.assign( x, void 0, 2, 0 ); // $ExpectError + cuany.assign( x, {}, 2, 0 ); // $ExpectError +} + + +// The compiler throws an error if the `assign` method is provided a third argument which is not a number... +{ + const x = [ false, false, true, false, false ]; + const y = [ false, null, false, null, false, null, false, null, false, null ]; + + cuany.assign( x, y , '1', 0 ); // $ExpectError + cuany.assign( x, y , true, 0 ); // $ExpectError + cuany.assign( x, y , false, 0 ); // $ExpectError + cuany.assign( x, y , null, 0 ); // $ExpectError + cuany.assign( x, y , void 0, 0 ); // $ExpectError + cuany.assign( x, y , {}, 0 ); // $ExpectError + cuany.assign( x, y , [], 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number... +{ + const x = [ false, false, true, false, false ]; + const y = [ false, null, false, null, false, null, false, null, false, null ]; + + cuany.assign( x, y, 1, '1' ); // $ExpectError + cuany.assign( x, y, 1, true ); // $ExpectError + cuany.assign( x, y, 1, false ); // $ExpectError + cuany.assign( x, y, 1, null ); // $ExpectError + cuany.assign( x, y, 1, void 0 ); // $ExpectError + cuany.assign( x, y, 1, {} ); // $ExpectError + cuany.assign( x, y, 1, [] ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... +{ + cuany.assign(); // $ExpectError + cuany.assign( [] ); // $ExpectError + cuany.assign( [], [] ); // $ExpectError + cuany.assign( [], [], 2 ); // $ExpectError + cuany.assign( [], [], 1, 1, {} ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/array/base/cuany/examples/index.js b/lib/node_modules/@stdlib/array/base/cuany/examples/index.js new file mode 100644 index 000000000000..5d7b31e6c429 --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/cuany/examples/index.js @@ -0,0 +1,30 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var bernoulli = require( '@stdlib/random/array/bernoulli' ); +var cuany = require( './../lib' ); + +// Create an array of random values: +var x = bernoulli( 10, 0.1 ); +console.log( x ); + +// Cumulatively determine whether values are truthy: +var out = cuany( x ); +console.log( out ); diff --git a/lib/node_modules/@stdlib/array/base/cuany/lib/assign.js b/lib/node_modules/@stdlib/array/base/cuany/lib/assign.js new file mode 100644 index 000000000000..40b7bb7d79c8 --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/cuany/lib/assign.js @@ -0,0 +1,230 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isComplex128Array = require( '@stdlib/array/base/assert/is-complex128array' ); +var isComplex64Array = require( '@stdlib/array/base/assert/is-complex64array' ); +var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +var reinterpret128 = require( '@stdlib/strided/base/reinterpret-complex128' ); +var reinterpret64 = require( '@stdlib/strided/base/reinterpret-complex64' ); + + +// FUNCTIONS // + +/** +* Cumulatively tests whether at least one element in an indexed array is truthy. +* +* @private +* @param {Collection} x - input array +* @param {Collection} y - output array +* @param {integer} stride - output array stride +* @param {NonNegativeInteger} offset - output array offset +* @returns {Collection} output array +* +* @example +* var x = [ false, false, true, false, false ]; +* var y = [ false, null, false, null, false, null, false, null, false, null ]; +* +* var out = indexed( x, y, 2, 0 ); +* // returns [ false, null, false, null, true, null, true, null, true, null ] +*/ +function indexed( x, y, stride, offset ) { + var flg; + var io; + var i; + + flg = false; + io = offset; + for ( i = 0; i < x.length; i++ ) { + if ( flg === false && x[ i ] ) { + flg = true; + } + y[ io ] = flg; + io += stride; + } + return y; +} + +/** +* Cumulatively tests whether at least one element in a provided accessor array is truthy. +* +* @private +* @param {Object} x - input array object +* @param {Object} y - output array object +* @param {integer} stride - output array stride +* @param {NonNegativeInteger} offset - output array offset +* @returns {Collection} output array +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* +* var x = toAccessorArray( [ false, false, true, false, false ] ); +* var y = toAccessorArray( [ false, null, false, null, false, null, false, null, false, null ] ); +* +* var arr = accessors( arraylike2object( x ), arraylike2object( y ), 2, 0 ); +* +* var v = y.get( 0 ); +* // returns false +* +* v = y.get( 2 ); +* // returns false +* +* v = y.get( 4 ); +* // returns true +* +* v = y.get( 6 ); +* // returns true +* +* v = y.get( 8 ); +* // returns true +*/ +function accessors( x, y, stride, offset ) { + var xdata; + var ydata; + var xget; + var yset; + var flg; + var io; + var i; + + xdata = x.data; + ydata = y.data; + + xget = x.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + flg = false; + io = offset; + for ( i = 0; i < xdata.length; i++ ) { + if ( flg === false && xget( xdata, i ) ) { + flg = true; + } + yset( ydata, io, flg ); + io += stride; + } + return ydata; +} + +/** +* Cumulatively tests whether at least one element in a provided complex number array is truthy. +* +* @private +* @param {Collection} x - array containing interleaved real and imaginary components +* @param {Object} y - output array object +* @param {integer} stride - output array stride +* @param {NonNegativeInteger} offset - output array offset +* @returns {Collection} output array +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* +* var x = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0 ] ); +* var y = toAccessorArray( [ false, null, false, null, false, null, false, null, false, null ] ); +* +* var arr = complex( x, arraylike2object( y ), 2, 0 ); +* +* var v = y.get( 0 ); +* // returns false +* +* v = y.get( 2 ); +* // returns false +* +* v = y.get( 4 ); +* // returns true +* +* v = y.get( 6 ); +* // returns true +* +* v = y.get( 8 ); +* // returns true +*/ +function complex( x, y, stride, offset ) { + var ydata; + var yset; + var flg; + var io; + var i; + + yset = y.accessors[ 1 ]; + ydata = y.data; + + flg = false; + io = offset; + for ( i = 0; i < x.length; i += 2 ) { + if ( flg === false && ( x[ i ] || x[ i+1 ] ) ) { + flg = true; + } + yset( ydata, io, flg ); + io += stride; + } + return ydata; +} + + +// MAIN // + +/** +* Cumulatively tests whether at least one element in an array is truthy and assigns results to provided output array. +* +* @param {Collection} x - input array +* @param {Collection} y - output array +* @param {integer} stride - output array stride +* @param {NonNegativeInteger} offset - output array offset +* @returns {Collection} output array +* +* @example +* var x = [ false, false, true, false, false ]; +* var y = [ false, null, false, null, false, null, false, null, false, null ]; +* +* var out = assign( x, y, 2, 0 ); +* // returns [ false, null, false, null, true, null, true, null, true, null ] +* +* var bool = ( y === out ); +* // returns true +*/ +function assign( x, y, stride, offset ) { + var xo = arraylike2object( x ); + var yo = arraylike2object( y ); + if ( + xo.accessorProtocol || + yo.accessorProtocol + ) { + // If provided a complex number array, reinterpret as a real typed array and test interleaved real and imaginary components, where we consider a complex number to be truthy if at least one component is non-zero... + if ( isComplex128Array( x ) ) { + complex( reinterpret128( x, 0 ), yo, stride, offset ); + } else if ( isComplex64Array( x ) ) { + complex( reinterpret64( x, 0 ), yo, stride, offset ); + } else { + accessors( xo, yo, stride, offset ); + } + return y; + } + indexed( x, y, stride, offset ); + return y; +} + + +// EXPORTS // + +module.exports = assign; diff --git a/lib/node_modules/@stdlib/array/base/cuany/lib/index.js b/lib/node_modules/@stdlib/array/base/cuany/lib/index.js new file mode 100644 index 000000000000..9f4be74a43ec --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/cuany/lib/index.js @@ -0,0 +1,58 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Cumulatively test whether at least one element in a provided array is truthy. +* +* @module @stdlib/array/base/cuany +* +* @example +* var cuany = require( '@stdlib/array/base/cuany' ); +* +* var x = [ false, false, true, false, false ]; +* +* var y = cuany( x ); +* // returns [ false, false, true, true, true ] +* +* @example +* var cuany = require( '@stdlib/array/base/cuany' ); +* +* var x = [ false, false, true, false, false ]; +* var y = [ false, null, false, null, false, null, false, null, false, null ]; +* +* var arr = cuany.assign( x, y, 2, 0 ); +* // returns [ false, null, false, null, true, null, true, null, true, null ] +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var main = require( './main.js' ); +var assign = require( './assign.js' ); + + +// MAIN // + +setReadOnly( main, 'assign', assign ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/array/base/cuany/lib/main.js b/lib/node_modules/@stdlib/array/base/cuany/lib/main.js new file mode 100644 index 000000000000..2d36c91662ec --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/cuany/lib/main.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var filled = require( '@stdlib/array/base/filled' ); +var assign = require( './assign.js' ); + + +// MAIN // + +/** +* Cumulatively tests whether at least one element in a provided array is truthy. +* +* @param {Collection} x - input array +* @returns {Array} output array +* +* @example +* var x = [ false, false, true, false, false ]; +* +* var y = cuany( x ); +* // returns [ false, false, true, true, true ] +*/ +function cuany( x ) { + var y = filled( false, x.length ); + return assign( x, y, 1, 0 ); +} + + +// EXPORTS // + +module.exports = cuany; diff --git a/lib/node_modules/@stdlib/array/base/cuany/package.json b/lib/node_modules/@stdlib/array/base/cuany/package.json new file mode 100644 index 000000000000..ecb5e36243da --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/cuany/package.json @@ -0,0 +1,67 @@ +{ + "name": "@stdlib/array/base/cuany", + "version": "0.0.0", + "description": "Cumulatively test whether at least one element in a provided array is truthy.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdtypes", + "types", + "data", + "structure", + "utils", + "generic", + "array", + "cuany", + "cumulative", + "test", + "some", + "array.some", + "validate" + ] +} diff --git a/lib/node_modules/@stdlib/array/base/cuany/test/test.assign.js b/lib/node_modules/@stdlib/array/base/cuany/test/test.assign.js new file mode 100644 index 000000000000..31d39fb2510d --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/cuany/test/test.assign.js @@ -0,0 +1,323 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Float64Array = require( '@stdlib/array/float64' ); +var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +var cuany = require( './../lib/assign.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof cuany, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function cumulatively tests whether at least one element is truthy (generic)', function test( t ) { + var expected; + var actual; + var x; + var y; + + x = [ true, false, true, false, true ]; + y = [ false, true, false, true, false ]; + + actual = cuany( x, y, 1, 0 ); + expected = [ true, true, true, true, true ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + x = [ false, false, true, false, false ]; + y = [ false, null, false, null, false, null, false, null, false, null ]; + + actual = cuany( x, y, 2, 0 ); + expected = [ false, null, false, null, true, null, true, null, true, null ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + x = [ false, false, true, false, false ]; + y = [ false, false, false, true, true, true ]; + + actual = cuany( x, y, 1, 1 ); + expected = [ false, false, false, true, true, true ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + x = []; + y = [ false, false, false, false, false ]; + + actual = cuany( x, y, 1, 0 ); + expected = [ false, false, false, false, false ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + x = [ true ]; + y = [ false, false ]; + + actual = cuany( x, y, 1, 1 ); + expected = [ false, true ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function cumulatively tests whether at least one element is truthy (typed)', function test( t ) { + var expected; + var actual; + var x; + var y; + + x = new Float64Array( [ 1.0, 0.0, 1.0, 0.0, 1.0 ] ); + y = [ false, true, false, true, false ]; + + actual = cuany( x, y, 1, 0 ); + expected = [ true, true, true, true, true ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Float64Array( [ 0.0, 0.0, 1.0, 0.0, 0.0 ] ); + y = [ false, null, false, null, false, null, false, null, false, null ]; + + actual = cuany( x, y, 2, 0 ); + expected = [ false, null, false, null, true, null, true, null, true, null ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Float64Array( [ 0.0, 0.0, 1.0, 0.0, 0.0 ] ); + y = [ false, false, false, true, true, true ]; + + actual = cuany( x, y, 1, 1 ); + expected = [ false, false, false, true, true, true ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Float64Array( [] ); + y = [ false, false, false, false, false ]; + + actual = cuany( x, y, 1, 0 ); + expected = [ false, false, false, false, false ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0 ] ); + y = [ false, false ]; + + actual = cuany( x, y, 1, 1 ); + expected = [ false, true ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function cumulatively tests whether at least one element is truthy (complex128)', function test( t ) { + var expected; + var actual; + var x; + var y; + + x = new Complex128Array( [ 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0 ] ); + y = [ false, true, false, true, false ]; + + actual = cuany( x, y, 1, 0 ); + expected = [ true, true, true, true, true ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0 ] ); + y = [ false, null, false, null, false, null, false, null, false, null ]; + + actual = cuany( x, y, 2, 0 ); + expected = [ false, null, false, null, true, null, true, null, true, null ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + y = [ false, false, false, true, true, true ]; + + actual = cuany( x, y, 1, 1 ); + expected = [ false, false, false, true, true, true ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Complex128Array( [] ); + y = [ false, false, false, false, false ]; + + actual = cuany( x, y, 1, 0 ); + expected = [ false, false, false, false, false ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Complex128Array( [ 1.0, 1.0 ] ); + y = [ false, false ]; + + actual = cuany( x, y, 1, 1 ); + expected = [ false, true ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function cumulatively tests whether at least one element is truthy (complex64)', function test( t ) { + var expected; + var actual; + var x; + var y; + + x = new Complex64Array( [ 0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0 ] ); + y = [ false, true, false, true, false ]; + + actual = cuany( x, y, 1, 0 ); + expected = [ true, true, true, true, true ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0 ] ); + y = [ false, null, false, null, false, null, false, null, false, null ]; + + actual = cuany( x, y, 2, 0 ); + expected = [ false, null, false, null, true, null, true, null, true, null ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + y = [ false, false, false, true, true, true ]; + + actual = cuany( x, y, 1, 1 ); + expected = [ false, false, false, true, true, true ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Complex64Array( [] ); + y = [ false, false, false, false, false ]; + + actual = cuany( x, y, 1, 0 ); + expected = [ false, false, false, false, false ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Complex64Array( [ 1.0, 1.0 ] ); + y = [ false, false ]; + + actual = cuany( x, y, 1, 1 ); + expected = [ false, true ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( actual, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function cumulatively tests whether at least one element is truthy (accessor)', function test( t ) { + var expected; + var actual; + var ybuf; + var x; + var y; + + x = toAccessorArray( [ true, false, true, false, true ] ); + ybuf = [ false, true, false, true, false ]; + y = toAccessorArray( ybuf ); + + actual = cuany( x, y, 1, 0 ); + expected = [ true, true, true, true, true ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( ybuf, expected, 'returns expected value' ); + + x = toAccessorArray( [ false, false, true, false, false ] ); + ybuf = [ false, null, false, null, false, null, false, null, false, null ]; + y = toAccessorArray( ybuf ); + + actual = cuany( x, y, 2, 0 ); + expected = [ false, null, false, null, true, null, true, null, true, null ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( ybuf, expected, 'returns expected value' ); + + x = toAccessorArray( [ false, false, true, false, false ] ); + ybuf = [ false, false, false, false, false, false ]; + y = toAccessorArray( ybuf ); + + actual = cuany( x, y, 1, 1 ); + expected = [ false, false, false, true, true, true ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( ybuf, expected, 'returns expected value' ); + + x = toAccessorArray( [ true, false, false, false, false ] ); + ybuf = [ false, false, false, false, false ]; + y = toAccessorArray( ybuf ); + + actual = cuany( x, y, 1, 0 ); + expected = [ true, true, true, true, true ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( ybuf, expected, 'returns expected value' ); + + x = toAccessorArray( [] ); + ybuf = [ false, false, false, false, false ]; + y = toAccessorArray( ybuf ); + + actual = cuany( x, y, 1, 0 ); + expected = [ false, false, false, false, false ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( ybuf, expected, 'returns expected value' ); + + x = toAccessorArray( [ true ] ); + ybuf = [ false, false ]; + y = toAccessorArray( ybuf ); + + actual = cuany( x, y, 1, 1 ); + expected = [ false, true ]; + + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( ybuf, expected, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/array/base/cuany/test/test.js b/lib/node_modules/@stdlib/array/base/cuany/test/test.js new file mode 100644 index 000000000000..a52ecece85ba --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/cuany/test/test.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasMethod = require( '@stdlib/assert/is-method' ); +var cuany = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof cuany, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'attached to the main export is an `assign` method', function test( t ) { + t.strictEqual( hasOwnProp( cuany, 'assign' ), true, 'returns expected value' ); + t.strictEqual( hasMethod( cuany, 'assign' ), true, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/array/base/cuany/test/test.main.js b/lib/node_modules/@stdlib/array/base/cuany/test/test.main.js new file mode 100644 index 000000000000..f4721db5c761 --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/cuany/test/test.main.js @@ -0,0 +1,203 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Float64Array = require( '@stdlib/array/float64' ); +var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +var cuany = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof cuany, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function cumulatively tests whether at least one element is truthy (generic)', function test( t ) { + var expected; + var actual; + var x; + + x = [ false, false, true, false, false ]; + actual = cuany( x ); + expected = [ false, false, true, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = [ 0.0, 0.0, 0.0, 0.0, 0.0 ]; + actual = cuany( x ); + expected = [ false, false, false, false, false ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = [ true, true, true, true, true ]; + actual = cuany( x ); + expected = [ true, true, true, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = [ null, {}, null ]; + actual = cuany( x ); + expected = [ false, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = [ true, false, false, false, false ]; + actual = cuany( x ); + expected = [ true, true, true, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function cumulatively tests whether at least one element is truthy (typed)', function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 0.0, 0.0, 1.0, 0.0, 0.0 ] ); + actual = cuany( x ); + expected = [ false, false, true, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + actual = cuany( x ); + expected = [ false, false, false, false, false ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + actual = cuany( x ); + expected = [ true, true, true, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Float64Array( [ 0.0, 1.0, 0.0 ] ); + actual = cuany( x ); + expected = [ false, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0, 0.0, 0.0, 0.0, 0.0 ] ); + actual = cuany( x ); + expected = [ true, true, true, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function cumulatively tests whether at least one element is truthy (complex128)', function test( t ) { + var expected; + var actual; + var x; + + x = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + actual = cuany( x ); + expected = [ false, false, true, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + actual = cuany( x ); + expected = [ false, false, false, false, false ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + actual = cuany( x ); + expected = [ true, true, true, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Complex128Array( [ 0.0, 0.0, 0.0, 1.0, 1.0, 0.0 ] ); + actual = cuany( x ); + expected = [ false, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Complex128Array( [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0 ] ); + actual = cuany( x ); + expected = [ true, true, true, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function cumulatively tests whether at least one element is truthy (complex64)', function test( t ) { + var expected; + var actual; + var x; + + x = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + actual = cuany( x ); + expected = [ false, false, true, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + actual = cuany( x ); + expected = [ false, false, false, false, false ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Complex64Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + actual = cuany( x ); + expected = [ true, true, true, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Complex64Array( [ 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 ] ); + actual = cuany( x ); + expected = [ false, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = new Complex64Array( [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0 ] ); + actual = cuany( x ); + expected = [ true, true, true, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function cumulatively tests whether at least one element of an accessor array is truthy (accessor)', function test( t ) { + var expected; + var actual; + var x; + + x = toAccessorArray( [ false, false, true, false, false ] ); + + actual = cuany( x ); + expected = [ false, false, true, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = toAccessorArray( [ false, false, false, false, false ] ); + actual = cuany( x ); + expected = [ false, false, false, false, false ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = toAccessorArray( [ true, true, true, true, true ] ); + actual = cuany( x ); + expected = [ true, true, true, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = toAccessorArray( [ false, true, false ] ); + actual = cuany( x ); + expected = [ false, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = toAccessorArray( [ true, false, false, false, false ] ); + actual = cuany( x ); + expected = [ true, true, true, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + t.end(); +});