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

Skip to content

Commit bc7917c

Browse files
committed
Transform error messages
1 parent b495401 commit bc7917c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;
2424
var isCollection = require( '@stdlib/assert-is-collection' );
25-
var format = require( '@stdlib/string-format' );
25+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
2626

2727

2828
// MAIN //
@@ -46,15 +46,15 @@ function ndims( x ) {
4646

4747
// 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...
4848
if ( typeof x !== 'object' || x === null ) {
49-
throw new TypeError( format( 'invalid argument. Must provide an ndarray. Value: `%s`.', x ) );
49+
throw new TypeError( format( '1k5Dv', x ) );
5050
}
5151
n = x.ndims;
5252
if ( isNonNegativeInteger( n ) ) {
5353
return n;
5454
}
5555
sh = x.shape;
5656
if ( !isCollection( sh ) ) {
57-
throw new TypeError( format( 'invalid argument. Must provide an ndarray. Value: `%s`.', x ) );
57+
throw new TypeError( format( '1k5Dv', x ) );
5858
}
5959
return sh.length;
6060
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"dependencies": {
4040
"@stdlib/assert-is-collection": "^0.2.2",
4141
"@stdlib/assert-is-nonnegative-integer": "^0.2.2",
42-
"@stdlib/string-format": "^0.2.2",
42+
"@stdlib/error-tools-fmtprodmsg": "^0.2.2",
4343
"@stdlib/types": "^0.3.2",
4444
"@stdlib/error-tools-fmtprodmsg": "^0.2.2"
4545
},

0 commit comments

Comments
 (0)
0