Skip to content

Commit 3c8bcb9

Browse files
committed
chore: minor clean-up
1 parent 177f16c commit 3c8bcb9

File tree

8 files changed

+78
-81
lines changed

8 files changed

+78
-81
lines changed

lib/node_modules/@stdlib/array/base/cunone-by-right/docs/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ interface CunoneByRight {
158158
* var x = [ 0, 0, 0, 1, 0 ];
159159
* var y = [ false, null, false, null, false, null, false, null, false, null ];
160160
*
161-
* var arr = cunoneBy.cunoneByRight( x, y, 2, 0, isPositive );,
161+
* var arr = cunoneBy.assign( x, y, 2, 0, isPositive );,
162162
* // returns [ true, null, false, null, false, null, false, null, false, null ]
163163
*/
164164
assign<T = unknown, U = unknown, V = unknown>( x: Collection<T> | AccessorArrayLike<T>, out: Collection<U> | AccessorArrayLike<U>, stride: number, offset: number, predicate: Predicate<T, V>, thisArg?: ThisParameterType<Predicate<T, V>> ): Collection<U | boolean> | AccessorArrayLike<U | boolean>;

lib/node_modules/@stdlib/array/base/cusome-by-right/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ var count = context.count;
7474

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

77-
Cumulatively tests whether at least `n` elements in a provided array pass a test implemented by a `predicate` function, while iterating from right-to-left and assign the results to the elements in the output array.
77+
Cumulatively tests whether at least `n` elements in a provided array pass a test implemented by a `predicate` function, while iterating from right-to-left, and assigns the results to the elements in the output array.
7878

7979
```javascript
8080
function fcn( v ) {

lib/node_modules/@stdlib/array/base/cusome-by-right/docs/repl.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838

3939

4040
{{alias}}.assign( x, n, out, stride, offset, predicate[, thisArg] )
41-
Cumulatively test whether at least `n` elements in a provided array pass a
42-
test implemented by a predicate function, while iterating from right-to-left
43-
and assign the results to the provided output array.
41+
Cumulatively tests whether at least `n` elements in a provided array pass a
42+
test implemented by a predicate function, while iterating from
43+
right-to-left, and assigns the results to the provided output array.
4444

4545
The predicate function is provided three arguments:
4646

lib/node_modules/@stdlib/array/base/cusome-by-right/docs/types/index.d.ts

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ type Predicate<T, U> = Nullary<U> | Unary<T, U> | Binary<T, U> | Ternary<T, U>;
7171
*/
7272
interface CusomeByRight {
7373
/**
74-
* Cumulatively test whether at least `n` elements in a provided array pass a test implemented by a predicate function, while iterating from right-to-left.
74+
* Cumulatively tests whether at least `n` elements in a provided array pass a test implemented by a predicate function, while iterating from right-to-left.
7575
*
7676
* @param x - input array
7777
* @param n - number of elements
@@ -91,7 +91,7 @@ interface CusomeByRight {
9191
<T = unknown, U = unknown>( x: Collection<T> | AccessorArrayLike<T>, n: number, predicate: Predicate<T, U>, thisArg?: ThisParameterType<Predicate<T, U>> ): Array<boolean>;
9292

9393
/**
94-
* Cumulatively test whether at least `n` elements in a provided array pass a test implemented by a predicate function, while iterating from right-to-left and assigns the results to the provided output array.
94+
* Cumulatively tests whether at least `n` elements in a provided array pass a test implemented by a predicate function, while iterating from right-to-left, and assigns the results to the provided output array.
9595
*
9696
* @param x - input array
9797
* @param n - number of elements
@@ -115,7 +115,7 @@ interface CusomeByRight {
115115
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>;
116116

117117
/**
118-
* Cumulatively test whether at least `n` elements in a provided array pass a test implemented by a predicate function, while iterating from right-to-left and assigns the results to the provided output array.
118+
* Cumulatively tests whether at least `n` elements in a provided array pass a test implemented by a predicate function, while iterating from right-to-left, and assigns the results to the provided output array.
119119
*
120120
* @param x - input array
121121
* @param n - number of elements
@@ -127,19 +127,24 @@ interface CusomeByRight {
127127
* @returns output array
128128
*
129129
* @example
130-
* function fcn( v ) {
131-
* return v > 0;
130+
* var BooleanArray = require( '@stdlib/array/bool' );
131+
*
132+
* function isPositive( v ) {
133+
* return ( v > 0 );
132134
* }
133-
* var x = [ 1, 1, 0, 0, 0 ];
134-
* var y = [ false, null, false, null, false, null, false, null, false, null ];
135+
* var x = [ 0, 0, 0, 1, 0 ];
136+
* var y = new BooleanArray( [ false, false, false, false, false, false, false, false, false, false ] );
135137
*
136-
* var arr = cusomeByRight.assign( x, 2, y, 2, 0, fcn );,
137-
* // returns [ false, null, false, null, false, null, false, null, true, null ];
138+
* var arr = cusomeByRight.assign( x, 2, y, 2, 0, isPositive );
139+
* // returns <BooleanArray>
140+
*
141+
* var v = arr.get( 4 );
142+
* // returns false
138143
*/
139144
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;
140145

141146
/**
142-
* Cumulatively tests whether no array element in a provided array passes a test implemented by a predicate function, while iterating from right-to-left, and assigns the results to the provided output array.
147+
* Cumulatively tests whether at least `n` elements in a provided array passes a test implemented by a predicate function, while iterating from right-to-left, and assigns the results to the provided output array.
143148
*
144149
* @param x - input array
145150
* @param n - number of elements
@@ -151,14 +156,14 @@ interface CusomeByRight {
151156
* @returns output array
152157
*
153158
* @example
154-
* function isPositive( v ) {
155-
* return ( v > 0 );
159+
* function fcn( v ) {
160+
* return v > 0;
156161
* }
157-
* var x = [ 0, 0, 0, 1, 0 ];
162+
* var x = [ 1, 1, 0, 0, 0 ];
158163
* var y = [ false, null, false, null, false, null, false, null, false, null ];
159164
*
160-
* var arr = cunoneBy.cunoneByRight( x, y, 2, 0, isPositive );,
161-
* // returns [ true, null, false, null, false, null, false, null, false, null ]
165+
* var arr = cusomeByRight.assign( x, 2, y, 2, 0, fcn );,
166+
* // returns [ false, null, false, null, false, null, false, null, true, null ];
162167
*/
163168
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>;
164169
}

lib/node_modules/@stdlib/array/base/cusome-by-right/docs/types/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ const isPositive = ( v: number ): boolean => {
169169
cusomeByRight.assign( x, 1, y, 1, [], isPositive ); // $ExpectError
170170
}
171171

172-
// The compiler throws an error if the `assign` method is provided a fifth argument which is not a function...
172+
// The compiler throws an error if the `assign` method is provided a sixth argument which is not a function...
173173
{
174174
const x = [ 1, 1, 0, 0, 0 ];
175175
const y = [ false, null, false, null, false, null, false, null, false, null ];

lib/node_modules/@stdlib/array/base/cusome-by-right/lib/assign.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var arraylike2object = require( '@stdlib/array/base/arraylike2object' );
2626
// FUNCTIONS //
2727

2828
/**
29-
* Cumulatively test whether at least `n` elements in a provided array pass a test implemented by a predicate function, while iterating from right-to-left and assign the results to elements in the provided output array.
29+
* Cumulatively tests whether at least `n` elements in a provided array pass a test implemented by a predicate function, while iterating from right-to-left, and assign the results to elements in the provided output array.
3030
*
3131
* @private
3232
* @param {Collection} x - input array
@@ -35,7 +35,7 @@ var arraylike2object = require( '@stdlib/array/base/arraylike2object' );
3535
* @param {integer} stride - output array stride
3636
* @param {NonNegativeInteger} offset - output array offset
3737
* @param {Function} predicate - test function
38-
* @param {*} [thisArg] - execution context
38+
* @param {*} thisArg - execution context
3939
* @returns {Collection} output array
4040
*
4141
* @example
@@ -72,7 +72,7 @@ function indexed( x, n, out, stride, offset, predicate, thisArg ) {
7272
}
7373

7474
/**
75-
* Cumulatively test whether at least `n` elements in a provided accessor array pass a test implemented by a predicate function, while iterating from right-to-left and assign the results to elements in the accessor output array.
75+
* Cumulatively tests whether at least `n` elements in a provided accessor array pass a test implemented by a predicate function, while iterating from right-to-left, and assigns the results to elements in the accessor output array.
7676
*
7777
* @private
7878
* @param {Object} x - input array object
@@ -81,7 +81,7 @@ function indexed( x, n, out, stride, offset, predicate, thisArg ) {
8181
* @param {integer} stride - output array stride
8282
* @param {NonNegativeInteger} offset - output array offset
8383
* @param {Function} predicate - test function
84-
* @param {*} [thisArg] - execution context
84+
* @param {*} thisArg - execution context
8585
* @returns {Collection} output array
8686
*
8787
* @example
@@ -137,7 +137,7 @@ function accessors( x, n, out, stride, offset, predicate, thisArg ) {
137137
// MAIN //
138138

139139
/**
140-
* Cumulatively test whether at least `n` elements in a provided array pass a test implemented by a predicate function, while iterating from right-to-left and assign the results to elements in the output array.
140+
* Cumulatively tests whether at least `n` elements in a provided array pass a test implemented by a predicate function, while iterating from right-to-left, and assigns the results to elements in the output array.
141141
*
142142
* @param {Collection} x - input array
143143
* @param {PositiveInteger} n - number of elements

lib/node_modules/@stdlib/array/base/cusome-by-right/test/test.assign.js

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
2626
var cusomeByRight = require( './../lib/assign.js' );
2727

2828

29+
// FUNCTIONS //
30+
31+
function isPositive( v ) {
32+
return v > 0;
33+
}
34+
35+
2936
// TESTS //
3037

3138
tape( 'main export is a function', function test( t ) {
@@ -40,14 +47,10 @@ tape( 'the function cumulatively tests whether at least n elements in a provided
4047
var x;
4148
var y;
4249

43-
function fcn( v ) {
44-
return v > 0;
45-
}
46-
4750
x = [ 1, 1, 0, 0, 1 ];
4851
y = [ false, true, false, true, false ];
4952

50-
actual = cusomeByRight( x, 2, y, 1, 0, fcn );
53+
actual = cusomeByRight( x, 2, y, 1, 0, isPositive );
5154
expected = [ false, false, false, true, true ];
5255

5356
t.strictEqual( actual, y, 'returns expected value' );
@@ -56,7 +59,7 @@ tape( 'the function cumulatively tests whether at least n elements in a provided
5659
x = [ 1, 1, 0, 0 ];
5760
y = [ false, null, false, null, false, null, false, null ];
5861

59-
actual = cusomeByRight( x, 2, y, 2, 0, fcn );
62+
actual = cusomeByRight( x, 2, y, 2, 0, isPositive );
6063
expected = [ false, null, false, null, false, null, true, null ];
6164

6265
t.strictEqual( actual, y, 'returns expected value' );
@@ -65,7 +68,7 @@ tape( 'the function cumulatively tests whether at least n elements in a provided
6568
x = [ 0, 0, 1, 0, 1 ];
6669
y = [ false, false, false, true, true, true ];
6770

68-
actual = cusomeByRight( x, 2, y, 1, 1, fcn );
71+
actual = cusomeByRight( x, 2, y, 1, 1, isPositive );
6972
expected = [ false, false, false, true, true, true ];
7073

7174
t.strictEqual( actual, y, 'returns expected value' );
@@ -74,7 +77,7 @@ tape( 'the function cumulatively tests whether at least n elements in a provided
7477
x = [];
7578
y = [ false, false, false, false, false ];
7679

77-
actual = cusomeByRight( x, 1, y, 1, 0, fcn );
80+
actual = cusomeByRight( x, 1, y, 1, 0, isPositive );
7881
expected = [ false, false, false, false, false ];
7982

8083
t.strictEqual( actual, y, 'returns expected value' );
@@ -83,7 +86,7 @@ tape( 'the function cumulatively tests whether at least n elements in a provided
8386
x = [ 1 ];
8487
y = [ false, false ];
8588

86-
actual = cusomeByRight( x, 1, y, 1, 1, fcn );
89+
actual = cusomeByRight( x, 1, y, 1, 1, isPositive );
8790
expected = [ false, true ];
8891

8992
t.strictEqual( actual, y, 'returns expected value' );
@@ -98,14 +101,10 @@ tape( 'the function cumulatively tests whether at least n elements in a provided
98101
var x;
99102
var y;
100103

101-
function fcn( v ) {
102-
return v > 0;
103-
}
104-
105104
x = new Float64Array( [ 1.0, 0.0, 1.0, 0.0, 1.0 ] );
106105
y = [ false, true, false, true, false ];
107106

108-
actual = cusomeByRight( x, 2, y, 1, 0, fcn );
107+
actual = cusomeByRight( x, 2, y, 1, 0, isPositive );
109108
expected = [ false, false, true, true, true ];
110109

111110
t.strictEqual( actual, y, 'returns expected value' );
@@ -114,7 +113,7 @@ tape( 'the function cumulatively tests whether at least n elements in a provided
114113
x = new Float64Array( [ 1.0, 1.0, 0.0, 0.0 ] );
115114
y = [ false, null, false, null, false, null, false, null ];
116115

117-
actual = cusomeByRight( x, 2, y, 2, 0, fcn );
116+
actual = cusomeByRight( x, 2, y, 2, 0, isPositive );
118117
expected = [ false, null, false, null, false, null, true, null ];
119118

120119
t.strictEqual( actual, y, 'returns expected value' );
@@ -123,7 +122,7 @@ tape( 'the function cumulatively tests whether at least n elements in a provided
123122
x = new Float64Array( [ 0.0, 1.0, 1.0, 0.0, 0.0 ] );
124123
y = [ true, false, false, true, true, true ];
125124

126-
actual = cusomeByRight( x, 2, y, 1, 1, fcn );
125+
actual = cusomeByRight( x, 2, y, 1, 1, isPositive );
127126
expected = [ true, false, false, false, true, true ];
128127

129128
t.strictEqual( actual, y, 'returns expected value' );
@@ -132,7 +131,7 @@ tape( 'the function cumulatively tests whether at least n elements in a provided
132131
x = new Float64Array( [] );
133132
y = [ false, false, false, false, false ];
134133

135-
actual = cusomeByRight( x, 1, y, 1, 0, fcn );
134+
actual = cusomeByRight( x, 1, y, 1, 0, isPositive );
136135
expected = [ false, false, false, false, false ];
137136

138137
t.strictEqual( actual, y, 'returns expected value' );
@@ -141,7 +140,7 @@ tape( 'the function cumulatively tests whether at least n elements in a provided
141140
x = new Float64Array( [ 1.0 ] );
142141
y = [ false, false ];
143142

144-
actual = cusomeByRight( x, 1, y, 1, 1, fcn );
143+
actual = cusomeByRight( x, 1, y, 1, 1, isPositive );
145144
expected = [ false, true ];
146145

147146
t.strictEqual( actual, y, 'returns expected value' );
@@ -157,14 +156,11 @@ tape( 'the function cumulatively tests whether at least n elements in a provided
157156
var x;
158157
var y;
159158

160-
function fcn( v ) {
161-
return v > 0;
162-
}
163159
x = toAccessorArray( [ 1, 0, 0, 0, 1 ] );
164160
ybuf = [ false, true, false, true, false ];
165161
y = toAccessorArray( ybuf );
166162

167-
actual = cusomeByRight( x, 2, y, 1, 0, fcn );
163+
actual = cusomeByRight( x, 2, y, 1, 0, isPositive );
168164
expected = [ false, false, false, false, true ];
169165

170166
t.strictEqual( actual, y, 'returns expected value' );
@@ -174,7 +170,7 @@ tape( 'the function cumulatively tests whether at least n elements in a provided
174170
ybuf = [ false, null, false, null, false, null, false, null ];
175171
y = toAccessorArray( ybuf );
176172

177-
actual = cusomeByRight( x, 2, y, 2, 0, fcn );
173+
actual = cusomeByRight( x, 2, y, 2, 0, isPositive );
178174
expected = [ false, null, false, null, true, null, true, null ];
179175

180176
t.strictEqual( actual, y, 'returns expected value' );
@@ -184,7 +180,7 @@ tape( 'the function cumulatively tests whether at least n elements in a provided
184180
ybuf = [ true, false, false, false, false, false ];
185181
y = toAccessorArray( ybuf );
186182

187-
actual = cusomeByRight( x, 2, y, 1, 1, fcn );
183+
actual = cusomeByRight( x, 2, y, 1, 1, isPositive );
188184
expected = [ true, false, false, false, true, true ];
189185

190186
t.strictEqual( actual, y, 'returns expected value' );
@@ -194,7 +190,7 @@ tape( 'the function cumulatively tests whether at least n elements in a provided
194190
ybuf = [ false, false, false, false, false ];
195191
y = toAccessorArray( ybuf );
196192

197-
actual = cusomeByRight( x, 1, y, 1, 0, fcn );
193+
actual = cusomeByRight( x, 1, y, 1, 0, isPositive );
198194
expected = [ true, true, true, true, true ];
199195

200196
t.strictEqual( actual, y, 'returns expected value' );
@@ -204,7 +200,7 @@ tape( 'the function cumulatively tests whether at least n elements in a provided
204200
ybuf = [ false, false, false, false, false ];
205201
y = toAccessorArray( ybuf );
206202

207-
actual = cusomeByRight( x, 1, y, 1, 0, fcn );
203+
actual = cusomeByRight( x, 1, y, 1, 0, isPositive );
208204
expected = [ false, false, false, false, false ];
209205

210206
t.strictEqual( actual, y, 'returns expected value' );
@@ -214,7 +210,7 @@ tape( 'the function cumulatively tests whether at least n elements in a provided
214210
ybuf = [ false, false ];
215211
y = toAccessorArray( ybuf );
216212

217-
actual = cusomeByRight( x, 0, y, 1, 1, fcn );
213+
actual = cusomeByRight( x, 0, y, 1, 1, isPositive );
218214
expected = [ false, true ];
219215

220216
t.strictEqual( actual, y, 'returns expected value' );

0 commit comments

Comments
 (0)