Skip to content

Commit 7aa3592

Browse files
committed
refactor: add explicit rank check
--- 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent cdb2bb5 commit 7aa3592

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

lib/node_modules/@stdlib/blas/ext/join/lib/assign.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function assign( x, out, options ) {
115115
}
116116
// Broadcast the separator to match the shape of the non-reduced dimensions...
117117
if ( isndarrayLike( s ) ) {
118-
// When not provided `dims`, the operation is performed across all dimensions and `s` is assumed to be a zero-dimensional ndarray; when `dims` is provided, we need to broadcast `s` to match the shape of the non-core dimensions...
118+
// When not provided `dims`, the operation is performed across all dimensions and `s` must be a zero-dimensional ndarray; when `dims` is provided, we need to broadcast `s` to match the shape of the non-core dimensions...
119119
if ( hasOwnProp( opts, 'dims' ) ) {
120120
s = maybeBroadcastArray( s, nonCoreShape( getShape( x ), opts.dims ) ); // eslint-disable-line max-len
121121
}

lib/node_modules/@stdlib/blas/ext/join/lib/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,11 @@ function join( x, options ) {
108108
}
109109
// Broadcast the separator to match the shape of the non-reduced dimensions...
110110
if ( isndarrayLike( s ) ) {
111-
// When not provided `dims`, the operation is performed across all dimensions and `s` is assumed to be a zero-dimensional ndarray; when `dims` is provided, we need to broadcast `s` to match the shape of the non-core dimensions...
111+
// When not provided `dims`, the operation is performed across all dimensions and `s` must be a zero-dimensional ndarray; when `dims` is provided, we need to broadcast `s` to match the shape of the non-core dimensions...
112112
if ( hasOwnProp( opts, 'dims' ) ) {
113113
s = maybeBroadcastArray( s, nonCoreShape( getShape( x ), opts.dims ) ); // eslint-disable-line max-len
114+
} else if ( getShape( s ).length !== 0 ) {
115+
throw new TypeError( format( 'invalid option. `%s` option must be a zero-dimensional ndarray.', 'sep' ) );
114116
}
115117
} else {
116118
if ( hasOwnProp( opts, 'dims' ) ) {

0 commit comments

Comments
 (0)