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

Skip to content

Commit c672a0c

Browse files
committed
Transform error messages
1 parent 52d3200 commit c672a0c

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
@@ -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 //
@@ -48,18 +48,18 @@ function shape( 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( '1kBDv', x ) );
5252
}
5353
sh = x.shape;
5454
if ( !isCollection( sh ) ) {
55-
throw new TypeError( format( 'invalid argument. Must provide an ndarray. Value: `%s`.', x ) );
55+
throw new TypeError( format( '1kBDv', x ) );
5656
}
5757
// Copy the shape in order to avoid unintended mutation...
5858
out = [];
5959
for ( i = 0; i < sh.length; i++ ) {
6060
d = sh[ i ];
6161
if ( !isNonNegativeInteger( d ) ) {
62-
throw new TypeError( format( 'invalid argument. Must provide an ndarray. Value: `%s`.', x ) );
62+
throw new TypeError( format( '1kBDv', x ) );
6363
}
6464
out.push( d );
6565
}

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.4.3",
4444
"@stdlib/error-tools-fmtprodmsg": "^0.2.2"
4545
},

0 commit comments

Comments
 (0)
0