8000 Transform error messages · stdlib-js/ndarray-stride@72d8789 · GitHub
[go: up one dir, main page]

Skip to content

Commit 72d8789

Browse files
committed
Transform error messages
1 parent 8be2a86 commit 72d8789

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/main.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;
2424
var isCollection = require( '@stdlib/assert-is-collection' );
2525
var getStride = require( '@stdlib/ndarray-base-stride' );
26-
var format = require( '@stdlib/string-format' );
26+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
2727

2828

2929
// MAIN //
@@ -49,17 +49,17 @@ function stride( x, dim ) {
4949

5050
// Note: we intentionally avoid rigorous ndarray checks to minimize performance impacts. This obviously means that non-ndarray-like objects can sneak through, but this is likely all right for the purposes of this function...
5151
if ( typeof x !== 'object' || x === null || !isCollection( x.shape ) ) {
52-
throw new TypeError( format( 'invalid argument. First argument must be an ndarray. Value: `%s`.', x ) );
52+
throw new TypeError( format( '1ml4f', x ) );
5353
}
5454
if ( !isInteger( dim ) ) {
55-
throw new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', dim ) );
55+
throw new TypeError( format( '1ml7f', dim ) );
5656
}
5757
st = getStride( x, dim );
5858
if ( isInteger( st ) ) {
5959
return st;
6060
}
6161
// As ndarrays must have integer-valued strides, if the returned "stride" value is not integer-valued, assume we haven't been provided an ndarray:
62-
throw new TypeError( format( 'invalid argument. First argument must be an ndarray. Value: `%s`.', x ) );
62+
throw new TypeError( format( '1ml4f', x ) );
6363
}
6464

6565

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@stdlib/assert-is-collection": "^0.2.2",
4141
"@stdlib/assert-is-integer": "^0.2.2",
4242
"@stdlib/ndarray-base-stride": "^0.2.2",
43-
"@stdlib/string-format": "^0.2.2",
43+
"@stdlib/error-tools-fmtprodmsg": "^0.2.2",
4444
"@stdlib/types": "^0.4.1",
4545
"@stdlib/error-tools-fmtprodmsg": "^0.2.2"
4646
},

0 commit comments

Comments
 (0)
0