8000 Transform error messages · stdlib-js/ndarray-base-ind@7f3065b · GitHub
[go: up one dir, main page]

Skip to content

Commit 7f3065b

Browse files
committed
Transform error messages
1 parent 72eb245 commit 7f3065b

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lib/factory.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var clampIndex = require( '@stdlib/ndarray-base-clamp-index' );
2424
var wrapIndex = require( '@stdlib/ndarray-base-wrap-index' );
2525
var normalize = require( '@stdlib/ndarray-base-normalize-index' );
2626
var isIndexMode = require( '@stdlib/ndarray-base-assert-is-index-mode' );
27-
var format = require( '@stdlib/string-format' );
27+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
2828

2929

3030
// VARIABLES //
@@ -60,7 +60,7 @@ var TABLE = {
6060
*/
6161
function throwIfOutOfBounds( idx, max ) {
6262
if ( idx < 0 || idx > max ) {
63-
throw new RangeError( format( 'invalid argument. Index must resolve to a value on the interval: [0, %d]. Value: `%d`.', max, idx ) );
63+
throw new RangeError( format( '0ilFB', max, idx ) );
6464
}
6565
return idx;
6666
}
@@ -87,7 +87,7 @@ function throwIfOutOfBounds( idx, max ) {
8787
function normalizeIndex( idx, max ) {
8888
var index = normalize( idx, max );
8989
if ( index < 0 || index > max ) {
90-
throw new RangeError( format( 'invalid argument. Index must resolve to a value on the interval: [0, %d]. Value: `%d`.', max, idx ) );
90+
throw new RangeError( format( '0ilFB', max, idx ) );
9191
}
9292
return index;
9393
}
@@ -152,7 +152,7 @@ function normalizeIndex( idx, max ) {
152152
*/
153153
function factory( mode ) {
154154
if ( !isIndexMode( mode ) ) {
155-
throw new TypeError( format( 'invalid argument. First argument must be a recognized index mode. Value: `%s`.', mode ) );
155+
throw new TypeError( format( '0ilFC', mode ) );
156156
}
157157
return TABLE[ mode ];
158158
}

lib/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
var clampIndex = require( '@stdlib/ndarray-base-clamp-index' );
2424
var wrapIndex = require( '@stdlib/ndarray-base-wrap-index' );
2525
var normalizeIndex = require( '@stdlib/ndarray-base-normalize-index' );
26-
var format = require( '@stdlib/string-format' );
26+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
2727

2828

2929
// MAIN //
@@ -90,7 +90,7 @@ function ind( idx, max, mode ) {
9090
index = normalizeIndex( index, max );
9191
}
9292
if ( index < 0 || index > max ) {
93-
throw new RangeError( format( 'invalid argument. Index must resolve to a value on the interval: [0, %d]. Value: `%d`.', max, idx ) );
93+
throw new RangeError( format( '0ilFB', max, idx ) );
9494
}
9595
return index;
9696
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"@stdlib/ndarray-base-normalize-index": "^0.2.2",
4545
"@stdlib/ndarray-base-wrap-index": "^0.2.2",
4646
"@stdlib/ndarray-index-modes": "^0.2.2",
47-
"@stdlib/string-format": "^0.2.2",
47+
"@stdlib/error-tools-fmtprodmsg": "^0.2.2",
4848
"@stdlib/types": "^0.4.3",
4949
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2",
5050
"@stdlib/utils-library-manifest": "^0.2.2",

0 commit comments

Comments
 (0)
0