Skip to content

Commit

Permalink
fix(base): fix linting and styling errors
Browse files Browse the repository at this point in the history
This commit fixes all the eslint errors and styling error
that were introduced in previous commits

PR-URL: stdlib-js#2805
Ref: stdlib-js#649
---------
Signed-off-by: Mohammad Kaif <[email protected]>
  • Loading branch information
Kaif987 committed Aug 25, 2024
1 parent 39718f1 commit 7679958
Show file tree
Hide file tree
Showing 10 changed files with 292 additions and 307 deletions.
10 changes: 5 additions & 5 deletions lib/node_modules/@stdlib/array/base/cuevery-by/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];
Expand Down Expand Up @@ -88,7 +88,7 @@ var bool = cueveryBy( x, fcn, context );
// returns [ true, true, false, false, false ]

var count = context.count;
// returns 5
// returns 3
```

</section>
Expand All @@ -108,14 +108,14 @@ var count = context.count;
<!-- eslint no-undef: "error" -->

```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 );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' );

Expand Down Expand Up @@ -72,7 +72,6 @@ function createBenchmark( len ) {
}



// MAIN //

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' );

Expand All @@ -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;

/**
Expand All @@ -52,7 +52,6 @@ function createBenchmark( len ) {
var v;
var i;


b.tic();
for ( i = 0; i < b.iterations; i++ ) {
v = cueveryBy( x, isPositiveInteger );
Expand Down
26 changes: 10 additions & 16 deletions lib/node_modules/@stdlib/array/base/cuevery-by/docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -29,18 +27,17 @@ var isPositive = ( v: number ): boolean => {
// The function returns an array...
{
cueveryBy( [ 1, 2, 3, 4 ], isPositive ); // $ExpectType boolean[]
cueveryBy<any>( [ 1, 2, 3, 4 ], isPositive); // $ExpectType boolean[]
cueveryBy<number>( [ 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...
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 ];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
Loading

0 comments on commit 7679958

Please sign in to comment.