Skip to content

Commit 87b82bb

Browse files
committed
Auto-generated commit
1 parent 7814c44 commit 87b82bb

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,9 @@ A total of 17 issues were closed in this release:
426426

427427
<details>
428428

429+
- [`d76442e`](https://github.com/stdlib-js/stdlib/commit/d76442e623bf8b7e8e4d50b80e90315b84cbf771) - **refactor:** add missing assertion _(by Athan Reines)_
430+
- [`aec1d1b`](https://github.com/stdlib-js/stdlib/commit/aec1d1b77f2f320cf740954b3c8147b1c90aded7) - **chore:** add TODO _(by Athan Reines)_
431+
- [`f99ec78`](https://github.com/stdlib-js/stdlib/commit/f99ec78d011d093ea3a102371d615f636a643b0a) - **refactor:** add missing assertion _(by Athan Reines)_
429432
- [`e031b1b`](https://github.com/stdlib-js/stdlib/commit/e031b1b5d6c8993087b34770ae694ba11c23532a) - **docs:** fix comment _(by Athan Reines)_
430433
- [`bcfac3b`](https://github.com/stdlib-js/stdlib/commit/bcfac3b4e64b90de693948adfffe3658f9b99e99) - **docs:** update example _(by Athan Reines)_
431434
- [`dc302b7`](https://github.com/stdlib-js/stdlib/commit/dc302b712bee9871320887a4473c707512dc9196) - **test:** fix broken tests _(by Athan Reines)_

count-if/lib/assign.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ function assign( x, y, options, predicate, thisArg ) {
108108
// Case: assign( x, y, predicate )
109109
if ( nargs < 4 ) {
110110
cb = options;
111+
if ( !isFunction( cb ) ) {
112+
throw new TypeError( format( 'invalid argument. Third argument must be a function. Value: `%s`.', cb ) );
113+
}
111114
}
112115
// Case: assign( x, y, options, predicate, thisArg )
113116
else if ( nargs > 4 ) {
@@ -141,6 +144,7 @@ function assign( x, y, options, predicate, thisArg ) {
141144
throw err;
142145
}
143146
}
147+
// When a list of dimensions is not provided, reduce the entire input array across all dimensions...
144148
if ( opts.dims === null ) {
145149
opts.dims = zeroTo( N );
146150
}

count-if/lib/main.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ function countIf( x, options, predicate, thisArg ) {
113113
// Case: countIf( x, predicate )
114114
if ( nargs < 3 ) {
115115
cb = options;
116+
if ( !isFunction( cb ) ) {
117+
throw new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', cb ) );
118+
}
116119
}
117120
// Case: countIf( x, options, predicate, thisArg )
118121
else if ( nargs > 3 ) {

count-if/test/test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,5 @@ tape( 'attached to the main export is an `assign` method', function test( t ) {
3737
t.strictEqual( isMethod( countIf, 'assign' ), true, 'returns expected value' );
3838
t.end();
3939
});
40+
41+
// TODO: add tests

0 commit comments

Comments
 (0)