Skip to content

Commit d8842cc

Browse files
committed
fix: guard against falsy options arguments
--- 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 dda72cb commit d8842cc

File tree

1 file changed

+3
-1
lines changed
  • lib/node_modules/@stdlib/stats/tools/reduce/unary-strided-dispatch/lib

1 file changed

+3
-1
lines changed

lib/node_modules/@stdlib/stats/tools/reduce/unary-strided-dispatch/lib/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ setReadOnly( UnaryStridedDispatch.prototype, 'assign', function assign( x ) {
310310
var arr;
311311
var err;
312312
var tmp;
313+
var flg;
313314
var dt;
314315
var N;
315316
var f;
@@ -341,6 +342,7 @@ setReadOnly( UnaryStridedDispatch.prototype, 'assign', function assign( x ) {
341342
// If we processed all but the last argument, assume that the last argument is an options argument...
342343
else if ( i === nargs-1 ) {
343344
options = arguments[ i ];
345+
flg = true;
344346
}
345347
// Otherwise, if we have more than one argument remaining, then at least one argument is not an ndarray but should be...
346348
else if ( i < nargs-1 ) {
@@ -356,7 +358,7 @@ setReadOnly( UnaryStridedDispatch.prototype, 'assign', function assign( x ) {
356358
// Validate any provided options...
357359
N = ndims( x );
358360
opts = objectAssign( {}, defaults );
359-
if ( options ) {
361+
if ( flg ) {
360362
err = validate( opts, N, this._odtypes, options );
361363
if ( err ) {
362364
throw err;

0 commit comments

Comments
 (0)