Skip to content

Commit

Permalink
chore: minor clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
Planeshifter committed Sep 29, 2024
1 parent 9019358 commit b667b52
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 36 deletions.
10 changes: 5 additions & 5 deletions lib/node_modules/@stdlib/array/base/cusome-by/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.

# cusomeBy

> Cumulatively tests whether atleast n array elements in a provided array pass a test implemented by a predicate function.
> Cumulatively test whether at least `n` array elements in a provided array pass a test implemented by a predicate function.
<section class="usage">

Expand All @@ -32,7 +32,7 @@ var cusomeBy = require( '@stdlib/array/base/cusome-by' );

#### cusomeBy( x, n, predicate\[, thisArg ] )

Cumulatively tests whether atleast n array elements in a provided array pass a test implemented by a predicate function.
Cumulatively tests whether at least `n` array elements in a provided array pass a test implemented by a predicate function.

```javascript
function fcn( value) {
Expand Down Expand Up @@ -74,7 +74,7 @@ var count = context.count;

#### cusomeBy.assign( x, n, out, stride, offset, predicate\[, thisArg ] )

Cumulatively tests whether atleast n array elements in a provided array pass a test implemented by a predicate function and assigns the results to a provided output array.
Cumulatively tests whether at least `n` array elements in a provided array pass a test implemented by a predicate function and assigns the results to a provided output array.

```javascript
function fcn( v ) {
Expand Down Expand Up @@ -119,8 +119,8 @@ function fcn( value ) {
var x = bernoulli( 10, 0.8 );
console.log( x );

// Cumulatively tests whether at least n array elements pass a test:
var y = cusomeBy( x, 2, fcn );
// Cumulatively test whether at least three array elements are positive:
var y = cusomeBy( x, 3, fcn );
console.log( y );
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ bench( pkg+'::copy:len=100', function benchmark( b ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
v = cusomeBy( x, 2, isPositiveInteger );
v = cusomeBy( x, 50, isPositiveInteger );
if ( typeof v !== 'object' ) {
b.fail( 'should return an array' );
}
Expand Down
4 changes: 2 additions & 2 deletions lib/node_modules/@stdlib/array/base/cusome-by/docs/repl.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

{{alias}}( x, n, predicate[, thisArg] )
Cumulatively tests whether at least n array elements in a provided
array passes a test implemented by a predicate function.
Cumulatively tests whether at least n array elements in a provided array
pass a test implemented by a predicate function.

The predicate function is provided three arguments:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ type Predicate<T, U> = Nullary<U> | Unary<T, U> | Binary<T, U> | Ternary<T, U>;
*/
interface CuSomeBy {
/**
* Cumulatively tests whether at least n array elements in a provided array passes a test implemented by a predicate function.
* Cumulatively tests whether at least `n` array elements in a provided array passes a test implemented by a predicate function.
*
* @param x - input array
* @param n - number of elements
Expand All @@ -86,12 +86,12 @@ interface CuSomeBy {
* var x = [ 0, 0, 0, 1, 1 ];
*
* var y = cusomeBy( x, 2, isPositive );
* // returns [ false, false, false, false, true, ];
* // returns [ false, false, false, false, true ];
*/
<T = unknown, U = unknown>( x: Collection<T> | AccessorArrayLike<T>, n: number, predicate: Predicate<T, U>, thisArg?: ThisParameterType<Predicate<T, U>> ): Array<boolean>;

/**
* Cumulatively tests whether aleast n array elements in a provided array pass a test implemented by a predicate function and assigns the results to the provided output array.
* Cumulatively tests whether at least `n` array elements in a provided array pass a test implemented by a predicate function and assigns the results to the provided output array.
*
* @param x - input array
* @param n - number of elements
Expand All @@ -115,7 +115,7 @@ interface CuSomeBy {
assign<T = unknown, U = unknown, V = unknown>( x: Collection<T> | AccessorArrayLike<T>, n: number, out: Array<U>, stride: number, offset: number, predicate: Predicate<T, V>, thisArg?: ThisParameterType<Predicate<T, V>> ): Array<U | boolean>;

/**
* Cumulatively tests whether atlest n array elements in a provided array pass a test implemented by a predicate function and assigns the results to the provided output array.
* Cumulatively tests whether at least `n` array elements in a provided array pass a test implemented by a predicate function and assigns the results to the provided output array.
*
* @param x - input array
* @param n - number of elements
Expand Down Expand Up @@ -144,7 +144,7 @@ interface CuSomeBy {
assign<T, U extends TypedArray | BooleanArray, V = unknown>( x: Collection<T> | AccessorArrayLike<T>, n: number, out: U, stride: number, offset: number, predicate: Predicate<T, V>, thisArg?: ThisParameterType<Predicate<T, V>> ): U;

/**
* Cumulatively tests whether atleast n array elements in a provided array pass a test implemented by a predicate function and assigns the results to the provided output array.
* Cumulatively tests whether at least `n` array elements in a provided array pass a test implemented by a predicate function and assigns the results to the provided output array.
*
* @param x - input array
* @param n - number of elements
Expand All @@ -162,15 +162,14 @@ interface CuSomeBy {
* var x = [ 0, 0, 0, 1, 1 ];
* var y = [ false, null, false, null, false, null, false, null, false, null ];
*
* var arr = cusomeBy.assign( x, 2, y, 2, 0, isPositive );,
* var arr = cusomeBy.assign( x, 2, y, 2, 0, isPositive );
* // returns [ false, null, false, null, false, null, false, null, true, null ];
*/
assign<T = unknown, U = unknown, V = unknown>( x: Collection<T> | AccessorArrayLike<T>, n: number, out: Collection<U> | AccessorArrayLike<U>, stride: number, offset: number, predicate: Predicate<T, V>, thisArg?: ThisParameterType<Predicate<T, V>> ): Collection<U | boolean> | AccessorArrayLike<U | boolean>;

}

/**
* Cumulatively tests whether atleast n array elements in a provided array pass a test implemented by a predicate function.
* Cumulatively tests whether at least `n` array elements in a provided array pass a test implemented by a predicate function.
*
* @param x - input array
* @param n - number of elements
Expand All @@ -180,7 +179,7 @@ interface CuSomeBy {
*
* @example
* function isPositive( v ) {
* return ( v > 0 );
* return ( v > 0 );
* }
* var x = [ 0, 0, 0, 1, 1 ];
*
Expand All @@ -189,7 +188,7 @@ interface CuSomeBy {
*
* @example
* function isPositive( v ) {
* return ( v > 0 );
* return ( v > 0 );
* }
* var x = [ 0, 0, 0, 1, 1 ];
* var y = [ false, null, false, null, false, null, false, null, false, null ];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ function fcn( value ) {
var x = bernoulli( 10, 0.8 );
console.log( x );

// Cumulatively tests whether at least 3 array elements in a provided array passes a test implemented by a predicate function.
// Cumulatively test whether at least three array elements are positive:
var y = cusomeBy( x, 3, fcn );
console.log( y );
10 changes: 6 additions & 4 deletions lib/node_modules/@stdlib/array/base/cusome-by/lib/assign.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var arraylike2object = require( '@stdlib/array/base/arraylike2object' );
// FUNCTIONS //

/**
* Cumulatively tests whether at least n array elements in a provided array passes a test implemented by a predicate function.
* Cumulatively tests whether at least `n` array elements in a provided array pass a test implemented by a predicate function and assigns the results to elements in the provided output array.
*
* @private
* @param {Collection} x - input array
Expand Down Expand Up @@ -70,7 +70,8 @@ function indexed( x, n, out, stride, offset, predicate, thisArg ) {
}

/**
* Cumulatively tests whether at least n array elements in a provided array passes a test implemented by a predicate function.
* Cumulatively tests whether at least `n` array elements in a provided array pass a test implemented by a predicate function and assigns the results to elements in the provided output array.
*
* @private
* @param {Object} x - input array object
* @param {integer} n - number of elements
Expand All @@ -92,7 +93,7 @@ function indexed( x, n, out, stride, offset, predicate, thisArg ) {
* var x = toAccessorArray( [ false, false, false, true, true ] );
*
* var out = toAccessorArray( [ false, null, false, null, false, null, false, null, false, null ] );
* var arr = accessors( arraylike2object( x ), 2, arraylike2object( out ), 2, 0, isPositive );
* var arr = accessors( arraylike2object( x ), 2, arraylike2object( out ), 2, 0, isPositive );
*
* var v = arr.get( 8 );
* // returns true
Expand Down Expand Up @@ -132,7 +133,8 @@ function accessors( x, n, out, stride, offset, predicate, thisArg ) {
// MAIN //

/**
* Cumulatively tests whether at least n array elements in a provided array passes a test implemented by a predicate function.
* Cumulatively tests whether at least `n` array elements in a provided array pass a test implemented by a predicate function and assigns the results to elements in the provided output array.
*
* @param {Collection} x - input array
* @param {integer} n - number of elements
* @param {Collection} out - output array
Expand Down
8 changes: 6 additions & 2 deletions lib/node_modules/@stdlib/array/base/cusome-by/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
'use strict';

/**
* Cumulatively tests whether at least n array elements in a provided array passes a test implemented by a predicate function.
* Cumulatively test whether at least `n` array elements in a provided array pass a test implemented by a predicate function.
*
* @module @stdlib/array/base/cusome-by
*
* @example
* var cusomeBy = require( '@stdlib/array/base/cusome-by' );
*
* function isPositive( value ) {
* return ( value > 0 );
* return ( value > 0 );
* }
*
* var x = [ 0, 0, 0, 1, 1 ];
Expand All @@ -37,6 +37,10 @@
* @example
* var cusomeBy = require( '@stdlib/array/base/cusome-by' );
*
* function isPositive( value ) {
* return ( value > 0 );
* }
*
* var x = [ 0, 0, 0, 1, 1 ];
*
* var y = [ false, null, false, null, false, null, false, null, false, null ];
Expand Down
4 changes: 2 additions & 2 deletions lib/node_modules/@stdlib/array/base/cusome-by/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var assign = require( './assign.js' );
// MAIN //

/**
* Cumulatively tests whether at least n array elements in a provided array passes a test implemented by a predicate function.
* Cumulatively tests whether at least `n` array elements in a provided array pass a test implemented by a predicate function.
*
* @param {Collection} x - input collection
* @param {integer} n - number of elements
Expand All @@ -37,7 +37,7 @@ var assign = require( './assign.js' );
*
* @example
* function isPositive( value ) {
* return ( value > 0 );
* return ( value > 0 );
* }
*
* var x = [ 0, 0, 0, 1, 1 ];
Expand Down
2 changes: 1 addition & 1 deletion lib/node_modules/@stdlib/array/base/cusome-by/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@stdlib/array/base/cusome-by",
"version": "0.0.0",
"description": "Cumulatively test whether at least n array elements in a provided array pass a test implemented by a predicate function.",
"description": "Cumulatively test whether at least `n` array elements in a provided array pass a test implemented by a predicate function.",
"license": "Apache-2.0",
"author": {
"name": "The Stdlib Authors",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,22 @@ var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
var cusomeBy = require( './../lib/assign.js' );


// TESTS //
// FUNCTIONS //

function isPositive( v ) {
return ( v > 0 );
}


// TESTS //

tape( 'main export is a function', function test( t ) {
t.ok( true, __filename );
t.strictEqual( typeof cusomeBy, 'function', 'main export is a function' );
t.end();
});

tape( 'the function cumulatively tests whether at least n array elements in a provided array pass a test implemented by a predicate function (generic)', function test( t ) {
tape( 'the function cumulatively tests whether at least `n` array elements in a provided array pass a test implemented by a predicate function (generic)', function test( t ) {
var expected;
var actual;
var x;
Expand Down Expand Up @@ -92,7 +95,7 @@ tape( 'the function cumulatively tests whether at least n array elements in a pr
t.end();
});

tape( 'the function cumulatively tests whether at least n array elements in a provided array pass a test implemented by a predicate function (typed)', function test( t ) {
tape( 'the function cumulatively tests whether at least `n` array elements in a provided array pass a test implemented by a predicate function (typed)', function test( t ) {
var expected;
var actual;
var x;
Expand Down Expand Up @@ -146,7 +149,7 @@ tape( 'the function cumulatively tests whether at least n array elements in a pr
t.end();
});

tape( 'the function cumulatively tests whether at least n array elements in a provided array pass a test implemented by a predicate function (accessor)', function test( t ) {
tape( 'the function cumulatively tests whether at least `n` array elements in a provided array pass a test implemented by a predicate function (accessor)', function test( t ) {
var expected;
var actual;
var ybuf;
Expand Down
11 changes: 7 additions & 4 deletions lib/node_modules/@stdlib/array/base/cusome-by/test/test.main.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,22 @@ var Float64Array = require( '@stdlib/array/float64' );
var cusomeBy = require( './../lib' );


// TESTS //
// FUNCTIONS //

function isPositive( v ) {
return ( v > 0 );
}


// TESTS //

tape( 'main export is a function', function test( t ) {
t.ok( true, __filename );
t.strictEqual(typeof cusomeBy, 'function', 'main export is a function');
t.end();
});

tape( 'the function cumulatively tests whether at least n elements in a provided array pass a test implemented by a predicate function (generic)', function test( t ) {
tape( 'the function cumulatively tests whether at least `n` elements in a provided array pass a test implemented by a predicate function (generic)', function test( t ) {
var expected;
var actual;
var x;
Expand Down Expand Up @@ -67,7 +70,7 @@ tape( 'the function cumulatively tests whether at least n elements in a provided
t.end();
});

tape( 'the function cumulatively tests whether at least n elements in a provided array pass a test implemented by a predicate function (typed)', function test( t ) {
tape( 'the function cumulatively tests whether at least `n` elements in a provided array pass a test implemented by a predicate function (typed)', function test( t ) {
var expected;
var actual;
var x;
Expand All @@ -90,7 +93,7 @@ tape( 'the function cumulatively tests whether at least n elements in a provided
t.end();
});

tape( 'the function cumulatively tests whether at least n elements in a provided array pass a test implemented by a predicate function (accessor array)', function test( t ) {
tape( 'the function cumulatively tests whether at least `n` elements in a provided array pass a test implemented by a predicate function (accessor array)', function test( t ) {
var expected;
var actual;
var x;
Expand Down

0 comments on commit b667b52

Please sign in to comment.