Skip to content

Commit 07710f8

Browse files
committed
fix: check for duplicate indices
--- 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 c09a971 commit 07710f8

File tree

1 file changed

+3
-0
lines changed
  • lib/node_modules/@stdlib/ndarray/includes/lib

1 file changed

+3
-0
lines changed

lib/node_modules/@stdlib/ndarray/includes/lib/validate.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ function validate( opts, ndims, options ) {
7373
if ( tmp === null ) {
7474
return new RangeError( format( 'invalid option. `%s` option contains an out-of-bounds dimension index. Option: [%s].', 'dims', join( opts.dims, ',' ) ) );
7575
}
76+
if ( tmp.length !== opts.dims.length ) {
77+
return new Error( format( 'invalid option. `%s` option contains duplicate indices. Option: [%s].', 'dims', join( opts.dims, ',' ) ) );
78+
}
7679
if ( tmp.length > ndims ) {
7780
return new RangeError( format( 'invalid option. `%s` option specifies more dimensions than exists in the input array. Number of dimensions: %d. Option: [%s].', ndims, join( opts.dims, ',' ) ) );
7881
}

0 commit comments

Comments
 (0)