Skip to content

Commit 38b878f

Browse files
kgryteanandkaranubc
authored andcommitted
refactor: add missing assertion
--- 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: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 7e50ad8 commit 38b878f

File tree

1 file changed

+4
-0
lines changed
  • lib/node_modules/@stdlib/ndarray/count-if/lib

1 file changed

+4
-0
lines changed

lib/node_modules/@stdlib/ndarray/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
}

0 commit comments

Comments
 (0)