Skip to content

Commit 78d537a

Browse files
committed
Transform error messages
1 parent b2de8f1 commit 78d537a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/main.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;
2424
var isCollection = require( '@stdlib/assert-is-collection' );
2525
var strides2offset = require( '@stdlib/ndarray-base-strides2offset' );
26-
var format = require( '@stdlib/string-format' );
26+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
2727

2828

2929
// MAIN //
@@ -48,15 +48,15 @@ function offset( x ) {
4848

4949
// 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...
5050
if ( typeof x !== 'object' || x === null ) {
51-
throw new TypeError( format( 'invalid argument. Must provide an ndarray. Value: `%s`.', x ) );
51+
throw new TypeError( format( 'nullKy', x ) );
5252
}
5353
n = x.offset;
5454
if ( isNonNegativeInteger( n ) ) {
5555
return n;
5656
}
5757
sh = x.shape;
5858
if ( !isCollection( sh ) ) {
59-
throw new TypeError( format( 'invalid argument. Must provide an ndarray. Value: `%s`.', x ) );
59+
throw new TypeError( format( 'nullKy', x ) );
6060
}
6161
st = x.strides;
6262
if ( sh.length === 0 || !isCollection( st ) ) {
@@ -66,7 +66,7 @@ function offset( x ) {
6666
if ( isNonNegativeInteger( n ) ) {
6767
return n;
6868
}
69-
throw new TypeError( format( 'invalid argument. Must provide an ndarray. Value: `%s`.', x ) );
69+
throw new TypeError( format( 'nullKy', x ) );
7070
}
7171

7272

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@stdlib/assert-is-collection": "^0.1.0",
4141
"@stdlib/assert-is-nonnegative-integer": "^0.1.0",
4242
"@stdlib/ndarray-base-strides2offset": "^0.1.1",
43-
"@stdlib/string-format": "^0.1.1",
43+
"@stdlib/error-tools-fmtprodmsg": "^0.1.1",
4444
"@stdlib/types": "^0.2.0"
4545
},
4646
"devDependencies": {

0 commit comments

Comments
 (0)