diff --git a/lib/node_modules/@stdlib/array/base/cuevery-by/README.md b/lib/node_modules/@stdlib/array/base/cuevery-by/README.md index e95dccea95f..0cd3d3e3197 100644 --- a/lib/node_modules/@stdlib/array/base/cuevery-by/README.md +++ b/lib/node_modules/@stdlib/array/base/cuevery-by/README.md @@ -36,7 +36,7 @@ Cumulatively test whether every array element in a provided array passes a test ```javascript function fcn( value) { - return ( value > 0 ) + return ( value > 0 ); } var x = [ 1, 1, 0, 0, 0 ]; @@ -88,7 +88,7 @@ var bool = cueveryBy( x, fcn, context ); // returns [ true, true, false, false, false ] var count = context.count; -// returns 5 +// returns 3 ``` @@ -108,14 +108,14 @@ var count = context.count; ```javascript -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var cueveryBy = require( '@stdlib/array/base/cuevery-by' ); function fcn( value ) { - return ( value > 0 ) + return ( value > 0 ); } -// Create an array of random values: +// Create an array of random values: var x = discreteUniform( 10, -10, 10 ); console.log( x ); diff --git a/lib/node_modules/@stdlib/array/base/cuevery-by/benchmark/benchmark.assign.length.js b/lib/node_modules/@stdlib/array/base/cuevery-by/benchmark/benchmark.assign.length.js index ed71bcc0d4d..31344ed8eba 100644 --- a/lib/node_modules/@stdlib/array/base/cuevery-by/benchmark/benchmark.assign.length.js +++ b/lib/node_modules/@stdlib/array/base/cuevery-by/benchmark/benchmark.assign.length.js @@ -24,7 +24,7 @@ var bench = require( '@stdlib/bench' ); var pow = require( '@stdlib/math/base/special/pow' ); var isArray = require( '@stdlib/assert/is-array' ); var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive; -var filled = require('@stdlib/array/base/filled') +var filled = require( '@stdlib/array/base/filled' ); var pkg = require( './../package.json' ).name; var cueveryBy = require( './../lib' ); @@ -72,7 +72,6 @@ function createBenchmark( len ) { } - // MAIN // /** diff --git a/lib/node_modules/@stdlib/array/base/cuevery-by/benchmark/benchmark.length.js b/lib/node_modules/@stdlib/array/base/cuevery-by/benchmark/benchmark.length.js index 49557a2d5f1..6519dd9bbe0 100644 --- a/lib/node_modules/@stdlib/array/base/cuevery-by/benchmark/benchmark.length.js +++ b/lib/node_modules/@stdlib/array/base/cuevery-by/benchmark/benchmark.length.js @@ -23,8 +23,8 @@ var bench = require( '@stdlib/bench' ); var pow = require( '@stdlib/math/base/special/pow' ); var isArray = require( '@stdlib/assert/is-array' ); -var isPositiveInteger = require('@stdlib/assert/is-positive-integer'); -var filled = require("@stdlib/array/base/filled") +var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ); +var filled = require( '@stdlib/array/base/filled' ); var pkg = require( './../package.json' ).name; var cueveryBy = require( './../lib' ); @@ -39,7 +39,7 @@ var cueveryBy = require( './../lib' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x = filled( 1.5, len ) + var x = filled( 1.5, len ); return benchmark; /** @@ -52,7 +52,6 @@ function createBenchmark( len ) { var v; var i; - b.tic(); for ( i = 0; i < b.iterations; i++ ) { v = cueveryBy( x, isPositiveInteger ); diff --git a/lib/node_modules/@stdlib/array/base/cuevery-by/docs/types/test.ts b/lib/node_modules/@stdlib/array/base/cuevery-by/docs/types/test.ts index f4ad6f07230..86c0cf11bde 100644 --- a/lib/node_modules/@stdlib/array/base/cuevery-by/docs/types/test.ts +++ b/lib/node_modules/@stdlib/array/base/cuevery-by/docs/types/test.ts @@ -16,8 +16,6 @@ * limitations under the License. */ -import Complex128Array = require( '@stdlib/array/complex128' ); -import Complex64Array = require( '@stdlib/array/complex64' ); import cueveryBy = require( './index' ); var isPositive = ( v: number ): boolean => { @@ -29,18 +27,17 @@ var isPositive = ( v: number ): boolean => { // The function returns an array... { cueveryBy( [ 1, 2, 3, 4 ], isPositive ); // $ExpectType boolean[] - cueveryBy( [ 1, 2, 3, 4 ], isPositive); // $ExpectType boolean[] cueveryBy( [ 1, 2, 3, 4 ], isPositive ); // $ExpectType boolean[] } // The compiler throws an error if the function is provided a first argument which is not an array-like object... { - cueveryBy( 1, isPositive); // $ExpectError - cueveryBy( true, isPositive); // $ExpectError - cueveryBy( false, isPositive); // $ExpectError - cueveryBy( null, isPositive); // $ExpectError - cueveryBy( void 0, isPositive); // $ExpectError - cueveryBy( {}, isPositive); // $ExpectError + cueveryBy( 1, isPositive ); // $ExpectError + cueveryBy( true, isPositive ); // $ExpectError + cueveryBy( false, isPositive ); // $ExpectError + cueveryBy( null, isPositive ); // $ExpectError + cueveryBy( void 0, isPositive ); // $ExpectError + cueveryBy( {}, isPositive ); // $ExpectError } // The compiler throws an error if the function is provided a second argument which is not an array-like object containing numbers... @@ -58,16 +55,14 @@ var isPositive = ( v: number ): boolean => { { cueveryBy(); // $ExpectError cueveryBy( [] ); // $ExpectError - cueveryBy( [], [] ); // $ExpectError cueveryBy( [], [], 'throw', {} ); // $ExpectError } // Attached to the main export is an `assign` method which returns a collection... { const x = [ 1, 2, 3, 4 ]; - const y = new Complex128Array( 4 ); - cueveryBy.assign( x, [ 0, 0, 0, 0 ], 1, 0, isPositive); // $ExpectType number[] + cueveryBy.assign( x, [ 0, 0, 0, 0 ], 1, 0, isPositive ); // $ExpectType number[] cueveryBy.assign( x, new Float64Array( 4 ), 1, 0, isPositive ); // $ExpectType Float64Array cueveryBy.assign( x, new Float32Array( 4 ), 1, 0, isPositive ); // $ExpectType Float32Array cueveryBy.assign( x, new Int32Array( 4 ), 1, 0, isPositive ); // $ExpectType Int32Array @@ -83,7 +78,7 @@ var isPositive = ( v: number ): boolean => { { const x = [ 1, 1, 0, 0, 0 ]; - cueveryBy.assign( 1, x, 2, 0, isPositive); // $ExpectError + cueveryBy.assign( 1, x, 2, 0, isPositive ); // $ExpectError cueveryBy.assign( true, x, 2, 0, isPositive ); // $ExpectError cueveryBy.assign( false, x, 2, 0, isPositive ); // $ExpectError cueveryBy.assign( null, x, 2, 0, isPositive ); // $ExpectError @@ -106,9 +101,9 @@ var isPositive = ( v: number ): boolean => { // The compiler throws an error if the `assign` method is provided a third argument which is not a valid index... { const x = [ 1, 1, 0, 0, 0 ]; - y = [ false, null, false, null, false, null, false, null, false, null ]; + const y = [ false, null, false, null, false, null, false, null, false, null ]; - cueveryBy.assign( x, y, '1', 1, isPositive); // $ExpectError + cueveryBy.assign( x, y, '1', 1, isPositive ); // $ExpectError cueveryBy.assign( x, y, true, 1, isPositive ); // $ExpectError cueveryBy.assign( x, y, false, 1, isPositive ); // $ExpectError cueveryBy.assign( x, y, null, 1, isPositive ); // $ExpectError @@ -133,7 +128,6 @@ var isPositive = ( v: number ): boolean => { } - // The compiler throws an error if the `assign` method is provided a fifth argument which is not a function... { const x = [ 1, 1, 0, 0, 0 ]; diff --git a/lib/node_modules/@stdlib/array/base/cuevery-by/examples/index.js b/lib/node_modules/@stdlib/array/base/cuevery-by/examples/index.js index c07f647ea4c..8733414beef 100644 --- a/lib/node_modules/@stdlib/array/base/cuevery-by/examples/index.js +++ b/lib/node_modules/@stdlib/array/base/cuevery-by/examples/index.js @@ -27,7 +27,7 @@ function fcn( value ) { // Generate an array of random values: var x = discreteUniform( 10, -10, 10 ); -console.log( x ) +console.log( x ); // Cumulatively tests whether every array element passes a test: var y = cueveryBy( x, fcn ); diff --git a/lib/node_modules/@stdlib/array/base/cuevery-by/lib/assign.js b/lib/node_modules/@stdlib/array/base/cuevery-by/lib/assign.js index ac4a44d2f85..728478f6d73 100644 --- a/lib/node_modules/@stdlib/array/base/cuevery-by/lib/assign.js +++ b/lib/node_modules/@stdlib/array/base/cuevery-by/lib/assign.js @@ -1,52 +1,53 @@ /** - * @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"; +* @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 arraylike2object = require( "@stdlib/array/base/arraylike2object" ); +var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); + // FUNCTIONS // /** - * Cumulatively tests whether very array element in a provided array passes a test implemented by a predicate function - * - * @private - * @param {Collection} x - input array - * @param {Collection} out - output array - * @param {integer} stride - output array stride - * @param {NonNegativeInteger} offset - output array offset - * @param {Function} predicate - test function - * @param {*} [thisArg] - execution context - * @returns {Collection} output array - * - * @example - * function isPositive( value ) { - * return ( value > 0 ); - * } - * - * var x = [ 1, 1, 0, 0, 0 ]; - * - * var out = [ 0, 0, 0, 0, 0 ]; - * var arr = indexed( x, out, 1, 0, isPositive ); - * // returns [ true, true, false, false, false ] - */ +* Cumulatively tests whether very array element in a provided array passes a test implemented by a predicate function. +* +* @private +* @param {Collection} x - input array +* @param {Collection} out - output array +* @param {integer} stride - output array stride +* @param {NonNegativeInteger} offset - output array offset +* @param {Function} predicate - test function +* @param {*} [thisArg] - execution context +* @returns {Collection} output array +* +* @example +* function isPositive( value ) { +* return ( value > 0 ); +* } +* +* var x = [ 1, 1, 0, 0, 0 ]; +* +* var out = [ 0, 0, 0, 0, 0 ]; +* var arr = indexed( x, out, 1, 0, isPositive ); +* // returns [ true, true, false, false, false ] +*/ function indexed( x, out, stride, offset, predicate, thisArg ) { var flg; var io; @@ -55,7 +56,7 @@ function indexed( x, out, stride, offset, predicate, thisArg ) { flg = true; io = offset; for ( i = 0; i <= x.length - 1; i++ ) { - if( !flg ){ + if ( !flg ) { out[ io ] = flg; io += stride; continue; @@ -70,33 +71,33 @@ function indexed( x, out, stride, offset, predicate, thisArg ) { } /** - * Cumulatively tests whether very array element in a provided array passes a test implemented by a predicate function. - * - * @private - * @param {Object} x - input array object - * @param {Object} out - output array object - * @param {integer} stride - output array stride - * @param {NonNegativeInteger} offset - output array offset - * @param {Function} predicate - test function - * @param {*} [thisArg] - execution context - * @returns {Collection} output array - * - * @example - * function isPositive( value ) { - * return ( value > 0 ); - * } - * - * var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); - * var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); - * - * var x = toAccessorArray( [ 1, 1, 0, 0, 0 ] ); - * - * var out = toAccessorArray( [ 0, 0, 0, 0, 0 ] ); - * var arr = accessors( arraylike2object( x ), arraylike2object( out ), 1, 0, isPositive ); - * - * var v = arr.get( 4 ); - * // returns false - */ +* Cumulatively tests whether very array element in a provided array passes a test implemented by a predicate function. +* +* @private +* @param {Object} x - input array object +* @param {Object} out - output array object +* @param {integer} stride - output array stride +* @param {NonNegativeInteger} offset - output array offset +* @param {Function} predicate - test function +* @param {*} [thisArg] - execution context +* @returns {Collection} output array +* +* @example +* function isPositive( value ) { +* return ( value > 0 ); +* } +* +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* +* var x = toAccessorArray( [ 1, 1, 0, 0, 0 ] ); +* +* var out = toAccessorArray( [ 0, 0, 0, 0, 0 ] ); +* var arr = accessors( arraylike2object( x ), arraylike2object( out ), 1, 0, isPositive ); +* +* var v = arr.get( 4 ); +* // returns false +*/ function accessors( x, out, stride, offset, predicate, thisArg ) { var xdata; var odata; @@ -115,10 +116,10 @@ function accessors( x, out, stride, offset, predicate, thisArg ) { io = offset; flg = true; for ( i = 0; i <= xdata.length - 1; i++ ) { - if( !flg ){ + if ( !flg ) { oset( odata, io, flg ); io += stride; - continue + continue; } if ( !predicate.call( thisArg, xget( xdata, i ), i, xdata ) ) { flg = false; @@ -129,33 +130,34 @@ function accessors( x, out, stride, offset, predicate, thisArg ) { return odata; } + // MAIN // /** - * Cumulatively tests whether very array element in a provided array passes a test implemented by a predicate function. - * - * @param {Collection} x - input array - * @param {Collection} out - output array - * @param {integer} stride - output array stride - * @param {NonNegativeInteger} offset - output array offset - * @param {Function} predicate - test function - * @param {*} [thisArg] - execution context - * @returns {Collection} output array - * - * @example - * function isPositive( value ) { - * return ( value > 0 ); - * } - * - * var x = [ 1, 1, 1, 0, 1 ]; - * - * var y = [ false, null, false, null, false, null, false, null, false, null ]; - * var out = assign( x, y, 2, 0, isPositive ); - * // returns [ true, null, true, null, true, null, false, null, false, null ] - * - * var bool = ( y === out ); - * // returns true - */ +* Cumulatively tests whether very array element in a provided array passes a test implemented by a predicate function. +* +* @param {Collection} x - input array +* @param {Collection} out - output array +* @param {integer} stride - output array stride +* @param {NonNegativeInteger} offset - output array offset +* @param {Function} predicate - test function +* @param {*} [thisArg] - execution context +* @returns {Collection} output array +* +* @example +* function isPositive( value ) { +* return ( value > 0 ); +* } +* +* var x = [ 1, 1, 1, 0, 1 ]; +* +* var y = [ false, null, false, null, false, null, false, null, false, null ]; +* var out = assign( x, y, 2, 0, isPositive ); +* // returns [ true, null, true, null, true, null, false, null, false, null ] +* +* var bool = ( y === out ); +* // returns true +*/ function assign( x, out, stride, offset, predicate, thisArg ) { var xo; var oo; @@ -170,6 +172,7 @@ function assign( x, out, stride, offset, predicate, thisArg ) { return out; } + // EXPORTS // module.exports = assign; diff --git a/lib/node_modules/@stdlib/array/base/cuevery-by/lib/index.js b/lib/node_modules/@stdlib/array/base/cuevery-by/lib/index.js index e228e557401..0a56a32660b 100644 --- a/lib/node_modules/@stdlib/array/base/cuevery-by/lib/index.js +++ b/lib/node_modules/@stdlib/array/base/cuevery-by/lib/index.js @@ -1,62 +1,63 @@ /** - * @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"; +* @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 tests whether every array element in a provided array passes a test implemented by a predicate function. - * - * @module @stdlib/array/base/cuevery-by - * - * @example - * var cueveryBy = require( '@stdlib/array/base/cuevery-by' ); - * - * function isPositive( value ) { - * return ( value > 0 ); - * } - * - * var x = [ 1, 1, 1, 0, 1 ]; - * var y = cueveryBy( x, isPositive ); - * // returns [ true, true, true, false, false ] - * - * @example - * var cueveryBy = require( '@stdlib/array/base/cuevery-by' ); - * - * var x = [ 1, 1, 1, 0, 1 ]; - * - * var y = [ false, null, false, null, false, null, false, null, false, null ]; - * var out = cueveryBy.assign( x, y, 2, 0, isPositive ); - * // returns [ true, null, true, null, true, null, false, null, false, null ] - * - * var bool = ( arr === out ); - * // returns true - - */ +* Cumulatively tests whether every array element in a provided array passes a test implemented by a predicate function. +* +* @module @stdlib/array/base/cuevery-by +* +* @example +* var cueveryBy = require( '@stdlib/array/base/cuevery-by' ); +* +* function isPositive( value ) { +* return ( value > 0 ); +* } +* +* var x = [ 1, 1, 1, 0, 1 ]; +* var y = cueveryBy( x, isPositive ); +* // returns [ true, true, true, false, false ] +* +* @example +* var cueveryBy = require( '@stdlib/array/base/cuevery-by' ); +* +* var x = [ 1, 1, 1, 0, 1 ]; +* +* var y = [ false, null, false, null, false, null, false, null, false, null ]; +* var out = cueveryBy.assign( x, y, 2, 0, isPositive ); +* // returns [ true, null, true, null, true, null, false, null, false, null ] +* +* var bool = ( arr === out ); +* // returns true +*/ // MODULES // -var setReadOnly = require("@stdlib/utils/define-nonenumerable-read-only-property"); -var main = require("./main.js"); -var assign = require("./assign.js"); +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); +setReadOnly(main, 'assign', assign); + // EXPORTS // diff --git a/lib/node_modules/@stdlib/array/base/cuevery-by/lib/main.js b/lib/node_modules/@stdlib/array/base/cuevery-by/lib/main.js index 5a051f533fc..772d33c805e 100644 --- a/lib/node_modules/@stdlib/array/base/cuevery-by/lib/main.js +++ b/lib/node_modules/@stdlib/array/base/cuevery-by/lib/main.js @@ -1,20 +1,20 @@ /** - * @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. - */ +* @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'; @@ -23,31 +23,33 @@ var filled = require( '@stdlib/array/base/filled' ); var assign = require( './assign.js' ); + // MAIN // /** - * Cumulatively tests whether very array element in a provided array passes a test implemented by a predicate function. - * - * @param {Collection} x - input collection - * @param {Function} predicate - test function - * @param {*} [thisArg] - execution context - * @returns {Array} output array - * - * @example - * function isPositive( value ) { - * return ( value > 0 ); - * } - * - * var x = [ 1, 1, 1, 0, 1 ]; - * - * var y = cueveryBy( x, isPositive ); - * // returns [ true, true, true, false, false ] - */ +* Cumulatively tests whether very array element in a provided array passes a test implemented by a predicate function. +* +* @param {Collection} x - input collection +* @param {Function} predicate - test function +* @param {*} [thisArg] - execution context +* @returns {Array} output array +* +* @example +* function isPositive( value ) { +* return ( value > 0 ); +* } +* +* var x = [ 1, 1, 1, 0, 1 ]; +* +* var y = cueveryBy( x, isPositive ); +* // returns [ true, true, true, false, false ] +*/ function cueveryBy( x, predicate, thisArg ) { var out = filled( false, x.length ); return assign( x, out, 1, 0, predicate, thisArg ); } + // EXPORTS // module.exports = cueveryBy; diff --git a/lib/node_modules/@stdlib/array/base/cuevery-by/test/test.assign.js b/lib/node_modules/@stdlib/array/base/cuevery-by/test/test.assign.js index d3c0a2a3184..b50c2831e58 100644 --- a/lib/node_modules/@stdlib/array/base/cuevery-by/test/test.assign.js +++ b/lib/node_modules/@stdlib/array/base/cuevery-by/test/test.assign.js @@ -28,6 +28,10 @@ var cueveryBy = require( './../lib/assign.js' ); // TESTS // +function isPositive( v ) { + return ( v > 0 ); +} + tape( 'main export is a function', function test( t ) { t.ok( true, __filename ); t.strictEqual( typeof cueveryBy, 'function', 'main export is a function' ); @@ -40,10 +44,6 @@ tape( 'the function cumulatively tests whether every array element in a provided var x; var y; - function isPositive( value ){ - return ( value > 0 ); - } - x = [ 1, 1, 1, 0, 1 ]; y = [ false, null, false, null, false, null, false, null, false, null ]; @@ -98,12 +98,8 @@ tape( 'the function cumulatively tests whether every array element in a provided var x; var y; - function isPositive( value ) { - return value > 0; - } - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - y = [ false, true, false, true, false ] + y = [ false, true, false, true, false ]; actual = cueveryBy( x, y, 1, 0, isPositive ); expected = [ true, true, true, true, false ]; @@ -157,9 +153,6 @@ tape( 'the function cumulatively tests whether every array element in a provided var x; var y; - function isPositive( v ) { - return ( v > 0 ); - } x = toAccessorArray( [ 1, 0, 0, 0, 1 ] ); ybuf = [ false, true, false, true, false ]; y = toAccessorArray( ybuf ); @@ -224,8 +217,8 @@ tape( 'the function cumulatively tests whether every array element in a provided }); tape( 'the function supports providing an execution context', function test( t ) { - var actual; var expected; + var actual; var ctx; var x; var y; @@ -249,4 +242,3 @@ tape( 'the function supports providing an execution context', function test( t ) return ( v > 0 ); } }); - diff --git a/lib/node_modules/@stdlib/array/base/cuevery-by/test/test.main.js b/lib/node_modules/@stdlib/array/base/cuevery-by/test/test.main.js index 8a5536d8896..87fa7422367 100644 --- a/lib/node_modules/@stdlib/array/base/cuevery-by/test/test.main.js +++ b/lib/node_modules/@stdlib/array/base/cuevery-by/test/test.main.js @@ -1,20 +1,20 @@ /** - * @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. - */ +* @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'; @@ -22,8 +22,10 @@ var tape = require( 'tape' ); var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +var Float64Array = require( '@stdlib/array/float64' ); var cueveryBy = require( './../lib' ); + // TESTS // function isPositive( v ) { @@ -36,40 +38,38 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the function cumulatively tests whether every array element in a provided array passes a test implemented by a predicate function (generic)', - function test( t ) { - var expected; - var actual; - var x; +tape( 'the function cumulatively tests whether every array element in a provided array passes a test implemented by a predicate function (generic)', function test( t ) { + var expected; + var actual; + var x; - function isNotNull( v ) { - return v !== null; - } + function isNotNull( v ) { + return v !== null; + } - x = [ 1, 2, 0, 4 ]; + x = [ 1, 2, 0, 4 ]; - actual = cueveryBy( x, isPositive ); - expected = [true, true, false, false]; - t.deepEqual( actual, expected, 'returns expected value' ); + actual = cueveryBy( x, isPositive ); + expected = [true, true, false, false]; + t.deepEqual( actual, expected, 'returns expected value' ); - x = [ 0.0, 0.0, 0.0, 1.0, 1.0 ]; - actual = cueveryBy( x, isPositive ); - expected = [ false, false, false, false, false ]; - t.deepEqual( actual, expected, 'returns expected value' ); + x = [ 0.0, 0.0, 0.0, 1.0, 1.0 ]; + actual = cueveryBy( x, isPositive ); + expected = [ false, false, false, false, false ]; + t.deepEqual( actual, expected, 'returns expected value' ); - x = [ true, true, true, true, true ]; - actual = cueveryBy( x, isPositive ); - expected = [ true, true, true, true, true ]; - t.deepEqual( actual, expected, 'returns expected value' ); + x = [ true, true, true, true, true ]; + actual = cueveryBy( x, isPositive ); + expected = [ true, true, true, true, true ]; + t.deepEqual( actual, expected, 'returns expected value' ); - x = [ {}, null, {} ]; - actual = cueveryBy( x, isNotNull ); - expected = [ true, false, false ]; - t.deepEqual( actual, expected, 'returns expected value' ); + x = [ {}, null, {} ]; + actual = cueveryBy( x, isNotNull ); + expected = [ true, false, false ]; + t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - } -); + t.end(); +}); tape( 'the function cumulatively tests whether every array element in a provided array passes a test implemented by a predicate function (typed)', function test( t ) { var expected; @@ -108,52 +108,48 @@ tape( 'the function cumulatively tests whether every array element in a provided t.end(); }); -tape( 'the function cumulatively tests whether every array element in a provided array passes a test implemented by a predicate function (accessor array)', - function test( t ) { - var expected; - var actual; - var x; - - x = toAccessorArray( [ 1, 1, 0, 0, 0 ] ); - - actual = cueveryBy( x, isPositive ); - expected = [true, true, false, false, false]; - t.deepEqual( actual, expected, 'returns expected value' ); - - x = toAccessorArray( [ 0, 0, 0, 0, 0 ] ); - actual = cueveryBy( x, isPositive ); - expected = [false, false, false, false, false]; - t.deepEqual( actual, expected, 'returns expected value' ); - - x = toAccessorArray( [ 1, 1, 1, 1, 1 ] ); - actual = cueveryBy( x, isPositive ); - expected = [true, true, true, true, true]; - t.deepEqual( actual, expected, 'returns expected value' ); - - x = toAccessorArray( [ 0, 1, 0 ] ); - actual = cueveryBy( x, isPositive ); - expected = [ false, false, false ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - x = toAccessorArray( [ 1, 0, 0, 0, 0 ] ); - actual = cueveryBy( x, isPositive ); - expected = [ true, false, false, false, false ]; - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - } -); +tape( 'the function cumulatively tests whether every array element in a provided array passes a test implemented by a predicate function (accessor array)', function test( t ) { + var expected; + var actual; + var x; -tape( 'the function returns an empty array if provided an empty input array as first argument', - function test( t ) { - var x = []; - t.deepEqual( cueveryBy( x, isPositive ), [], 'returns expected value' ); - t.end(); - } -); + x = toAccessorArray( [ 1, 1, 0, 0, 0 ] ); + + actual = cueveryBy( x, isPositive ); + expected = [true, true, false, false, false]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = toAccessorArray( [ 0, 0, 0, 0, 0 ] ); + actual = cueveryBy( x, isPositive ); + expected = [false, false, false, false, false]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = toAccessorArray( [ 1, 1, 1, 1, 1 ] ); + actual = cueveryBy( x, isPositive ); + expected = [true, true, true, true, true]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = toAccessorArray( [ 0, 1, 0 ] ); + actual = cueveryBy( x, isPositive ); + expected = [ false, false, false ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + x = toAccessorArray( [ 1, 0, 0, 0, 0 ] ); + actual = cueveryBy( x, isPositive ); + expected = [ true, false, false, false, false ]; + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns an empty array if provided an empty input array as first argument', function test( t ) { + var x = []; + t.deepEqual( cueveryBy( x, isPositive ), [], 'returns expected value' ); + t.end(); +}); tape( 'the function supports providing an execution context', function test( t ) { - var out; var expected; + var out; var ctx; var x; @@ -161,7 +157,7 @@ tape( 'the function supports providing an execution context', function test( t ) 'count': 0 }; - x = [ 1, 2, 0, 4 ] + x = [ 1, 2, 0, 4 ]; out = cueveryBy( x, predicate, ctx ); expected = [ true, true, false, false ]; @@ -175,4 +171,3 @@ tape( 'the function supports providing an execution context', function test( t ) return ( v > 0 ); } }); -