Skip to content

Commit 903bcf0

Browse files
committed
chore: clean-up
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed ---
1 parent 59ce154 commit 903bcf0

File tree

10 files changed

+247
-105
lines changed

10 files changed

+247
-105
lines changed

lib/node_modules/@stdlib/array/base/count-ifs/README.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# countIfs
2222

23-
> Count the number of elements in the input arrays which pass the tests implemented by the predicate functions.
23+
> Perform element-wise evaluation of one or more input arrays according to provided predicate functions and count the number of elements for which all predicates respectively return `true`.
2424
2525
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
2626

@@ -40,9 +40,9 @@ limitations under the License.
4040
var countIfs = require( '@stdlib/array/base/count-ifs' );
4141
```
4242

43-
#### countIfs( x0, predicate0\[, x1, predicate1\[, x2, predicate2, ...]] )
43+
#### countIfs( x0, predicate0\[, x1, predicate1\[, x2, predicate2\[, ...args]] )
4444

45-
Counts the number of elements in the input arrays which pass the tests implemented by the predicate functions.
45+
Performs element-wise evaluation of one or more input arrays according to provided predicate functions and counts the number of elements for which all predicates respectively return `true`.
4646

4747
```javascript
4848
function predicate0( value ) {
@@ -60,11 +60,21 @@ var out = countIfs( x0, predicate0, x1, predicate1 );
6060
// returns 1
6161
```
6262

63+
The function has the following parameters:
64+
65+
- **x0**: first input array.
66+
- **predicate0**: first predicate function.
67+
- **x1**: second input array (_optional_).
68+
- **predicate1**: second predicate function (_optional_).
69+
- **x2**: third input array (_optional_).
70+
- **predicate2**: third predicate function (_optional_).
71+
- **args**: additional input arrays and corresponding predicate functions (_optional_).
72+
6373
Each predicate function is provided three arguments:
6474

6575
- **value**: current array element.
6676
- **index**: current array element index.
67-
- **arr**: input array.
77+
- **arr**: the corresponding input array.
6878

6979
</section>
7080

@@ -91,7 +101,7 @@ Each predicate function is provided three arguments:
91101

92102
<!-- eslint no-undef: "error" -->
93103

94-
<!-- eslint max-len: "off" -->
104+
<!-- eslint-disable max-len -->
95105

96106
```javascript
97107
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
@@ -103,18 +113,14 @@ var countIfs = require( '@stdlib/array/base/count-ifs' );
103113
var x = discreteUniform( 10, -5, 5, {
104114
'dtype': 'int32'
105115
});
106-
// returns <Int32Array>
116+
console.log( x );
107117

108118
var y = discreteUniform( 10, -5, 5, {
109119
'dtype': 'int32'
110120
});
111-
// returns <Int32Array>
121+
console.log( y );
112122

113123
var out = countIfs( x, naryFunction( isPositiveInteger, 1 ), y, naryFunction( isNegativeInteger, 1 ) );
114-
// returns <number>
115-
116-
console.log( x );
117-
console.log( y );
118124
console.log( out );
119125
```
120126

lib/node_modules/@stdlib/array/base/count-ifs/benchmark/benchmark.length.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function main() {
116116
len = pow( 10, i );
117117

118118
f = createBenchmark( len );
119-
bench( pkg+':dtype=generic,len='+len, f );
119+
bench( pkg+':dtype=generic,predicates=2,len='+len, f );
120120
}
121121
}
122122

lib/node_modules/@stdlib/array/base/count-ifs/docs/repl.txt

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11

2-
{{alias}}( x0, predicate0[, x1, predicate1[, x2, predicate2, ...]] )
3-
Counts the number of elements in the input arrays which pass the tests
4-
implemented by the predicate functions.
2+
{{alias}}( x0, predicate0[, x1, predicate1[, x2, predicate2[, ...args]] )
3+
Performs element-wise evaluation of one or more input arrays according to
4+
provided predicate functions and counts the number of elements for which all
5+
predicates respectively return `true`.
56

67
Each predicate function is provided three arguments:
78

89
- value: current array element.
910
- index: current array element index.
10-
- arr: the input array.
11+
- arr: the corresponding input array.
1112

1213
Parameters
1314
----------
@@ -23,6 +24,15 @@
2324
predicate1: Function (optional)
2425
Second predicate function.
2526

27+
x2: ArrayLikeObject (optional)
28+
Third input array.
29+
30+
predicate2: Function (optional)
31+
Third predicate function.
32+
33+
...args: ArrayLikeObject|Function (optional)
34+
Additional input arrays and corresponding predicate functions.
35+
2636
Returns
2737
-------
2838
out: integer
@@ -37,3 +47,4 @@
3747

3848
See Also
3949
--------
50+

lib/node_modules/@stdlib/array/base/count-ifs/docs/types/index.d.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import { Collection, AccessorArrayLike } from '@stdlib/types/array';
2424

2525
/**
26-
* Input array
26+
* Input array.
2727
*/
2828
type InputArray<T> = Collection<T> | AccessorArrayLike<T>;
2929

@@ -69,10 +69,10 @@ type Ternary<T, U> = ( value: T, index: number, arr: U ) => boolean;
6969
* @param arr - input array
7070
* @returns boolean indicating whether an element passes a test
7171
*/
72-
type Predicate<T,U> = Nullary | Unary<U> | Binary<U> | Ternary<T,U>;
72+
type Predicate<T, U> = Nullary | Unary<U> | Binary<U> | Ternary<T, U>;
7373

7474
/**
75-
* Counts the number of elements in the input arrays which pass the tests implemented by the predicate functions.
75+
* Performs element-wise evaluation of one or more input arrays according to provided predicate functions and counts the number of elements for which all predicates respectively return `true`.
7676
*
7777
* @param x0 - input array
7878
* @param predicate0 - predicate function
@@ -88,10 +88,10 @@ type Predicate<T,U> = Nullary | Unary<U> | Binary<U> | Ternary<T,U>;
8888
* var n = countIfs( x0, predicate0 );
8989
* // returns 3
9090
*/
91-
declare function countIfs<T, U extends InputArray<T>>( x0: U, predicate0: Predicate<T,U> ): number;
91+
declare function countIfs<T = unknown, U extends InputArray<T> = InputArray<T>>( x0: U, predicate0: Predicate<T, U> ): number;
9292

9393
/**
94-
* Counts the number of elements in the input arrays which pass the tests implemented by the predicate functions.
94+
* Performs element-wise evaluation of one or more input arrays according to provided predicate functions and counts the number of elements for which all predicates respectively return `true`.
9595
*
9696
* @param x0 - first input array
9797
* @param predicate0 - first predicate function
@@ -114,10 +114,10 @@ declare function countIfs<T, U extends InputArray<T>>( x0: U, predicate0: Predic
114114
* var n = countIfs( x0, predicate0, x1, predicate1 );
115115
* // returns 2
116116
*/
117-
declare function countIfs<T, U extends InputArray<T>>( x0: U, predicate0: Predicate<T,U>, x1: U, predicate1: Predicate<T,U> ): number;
117+
declare function countIfs<T = unknown, U extends InputArray<T> = InputArray<T>>( x0: U, predicate0: Predicate<T, U>, x1: U, predicate1: Predicate<T, U> ): number;
118118

119119
/**
120-
* Counts the number of elements in the input arrays which pass the tests implemented by the predicate functions.
120+
* Performs element-wise evaluation of one or more input arrays according to provided predicate functions and counts the number of elements for which all predicates respectively return `true`.
121121
*
122122
* @param x0 - first input array
123123
* @param predicate0 - first predicate function
@@ -147,10 +147,10 @@ declare function countIfs<T, U extends InputArray<T>>( x0: U, predicate0: Predic
147147
* var n = countIfs( x0, predicate0, x1, predicate1 );
148148
* // returns 2
149149
*/
150-
declare function countIfs<T, U extends InputArray<T>>( x0: U, predicate0: Predicate<T,U>, x1: U, predicate1: Predicate<T,U>, x2: U, predicate2: Predicate<T,U> ): number;
150+
declare function countIfs<T = unknown, U extends InputArray<T> = InputArray<T>>( x0: U, predicate0: Predicate<T, U>, x1: U, predicate1: Predicate<T, U>, x2: U, predicate2: Predicate<T, U> ): number;
151151

152152
/**
153-
* Counts the number of elements in the input arrays which pass the tests implemented by the predicate functions.
153+
* Performs element-wise evaluation of one or more input arrays according to provided predicate functions and counts the number of elements for which all predicates respectively return `true`.
154154
*
155155
* @param x0 - first input array
156156
* @param predicate0 - first predicate function
@@ -187,10 +187,10 @@ declare function countIfs<T, U extends InputArray<T>>( x0: U, predicate0: Predic
187187
* var n = countIfs( x0, predicate0, x1, predicate1, x3, predicate3 );
188188
* // returns 2
189189
*/
190-
declare function countIfs<T, U extends InputArray<T>>( x0: U, predicate0: Predicate<T,U>, x1: U, predicate1: Predicate<T,U>, x2: U, predicate2: Predicate<T,U>, x3: U, predicate3: Predicate<T,U> ): number;
190+
declare function countIfs<T = unknown, U extends InputArray<T> = InputArray<T>>( x0: U, predicate0: Predicate<T, U>, x1: U, predicate1: Predicate<T, U>, x2: U, predicate2: Predicate<T, U>, x3: U, predicate3: Predicate<T, U> ): number;
191191

192192
/**
193-
* Counts the number of elements in the input arrays which pass the tests implemented by the predicate functions.
193+
* Performs element-wise evaluation of one or more input arrays according to provided predicate functions and counts the number of elements for which all predicates respectively return `true`.
194194
*
195195
* @param x0 - first input array
196196
* @param predicate0 - first predicate function
@@ -202,7 +202,7 @@ declare function countIfs<T, U extends InputArray<T>>( x0: U, predicate0: Predic
202202
* @param predicate3 - fourth predicate function
203203
* @param x4 - fifth input array
204204
* @param predicate4 - fifth predicate function
205-
* @param args - additional input values
205+
* @param args - additional input arrays and predicate functions
206206
* @returns result
207207
*
208208
* @example
@@ -235,7 +235,7 @@ declare function countIfs<T, U extends InputArray<T>>( x0: U, predicate0: Predic
235235
* var n = countIfs( x0, predicate0, x1, predicate1, x3, predicate3, x4, predicate4 );
236236
* // returns 2
237237
*/
238-
declare function countIfs<T, U extends InputArray<T>>( x0: U, predicate0: Predicate<T,U>, x1: U, predicate1: Predicate<T,U>, x2: U, predicate2: Predicate<T,U>, x3: U, predicate3: Predicate<T,U>, x4: U, predicate4: Predicate<T,U>, ...args: Array<U | Predicate<T,U>> ): number;
238+
declare function countIfs<T = unknown, U extends InputArray<T> = InputArray<T>>( x0: U, predicate0: Predicate<T, U>, x1: U, predicate1: Predicate<T, U>, x2: U, predicate2: Predicate<T, U>, x3: U, predicate3: Predicate<T, U>, x4: U, predicate4: Predicate<T, U>, ...args: Array<U | Predicate<T, U>> ): number;
239239

240240

241241
// EXPORTS //

0 commit comments

Comments
 (0)