Skip to content

Commit 0367f1d

Browse files
committed
refactor: fix error messages and use string interpolation
--- 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 4af8519 commit 0367f1d

File tree

1 file changed

+3
-2
lines changed
  • lib/node_modules/@stdlib/ndarray/base/map/lib

1 file changed

+3
-2
lines changed

lib/node_modules/@stdlib/ndarray/base/map/lib/main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
var iterationOrder = require( '@stdlib/ndarray/base/iteration-order' );
2424
var strides2order = require( '@stdlib/ndarray/base/strides2order' );
2525
var ndarray2object = require( '@stdlib/ndarray/base/ndarraylike2object' );
26+
var format = require( '@stdlib/string/format' );
2627
var blockedaccessormap2d = require( './2d_blocked_accessors.js' );
2728
var blockedaccessormap3d = require( './3d_blocked_accessors.js' );
2829
var blockedaccessormap4d = require( './4d_blocked_accessors.js' );
@@ -211,7 +212,7 @@ function map( arrays, fcn, thisArg ) {
211212
shy = y.shape;
212213
ndims = shx.length;
213214
if ( ndims !== shy.length ) {
214-
throw new Error( 'invalid arguments. Arrays must have the same number of dimensions (i.e., same rank). ndims(x) == '+ndims+'. ndims(y) == '+shy.length+'.' );
215+
throw new Error( format( 'invalid arguments. Arrays must have the same number of dimensions (i.e., same rank). ndims(x) == %d. ndims(y) == %d.', ndims, shy.length ) );
215216
}
216217
// Determine whether we can avoid iteration altogether...
217218
if ( ndims === 0 ) {
@@ -225,7 +226,7 @@ function map( arrays, fcn, thisArg ) {
225226
for ( i = 0; i < ndims; i++ ) {
226227
d = shx[ i ];
227228
if ( d !== shy[ i ] ) {
228-
throw new Error( 'invalid arguments. Array must have the same shape.' );
229+
throw new Error( 'invalid arguments. Arrays must have the same shape.' );
229230
}
230231
// Note that, if one of the dimensions is `0`, the length will be `0`...
231232
len *= d;

0 commit comments

Comments
 (0)