diff --git a/lib/main.js b/lib/main.js index 7b1217f..7194ece 100644 --- a/lib/main.js +++ b/lib/main.js @@ -30,7 +30,7 @@ var MultiSlice = require( '@stdlib/slice-multi' ); var args2multislice = require( '@stdlib/slice-base-args2multislice' ); var base = require( '@stdlib/ndarray-base-slice' ); var getShape = require( '@stdlib/ndarray-shape' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -98,32 +98,32 @@ function slice( x, s ) { }; nargs = arguments.length; if ( !isndarrayLike( x ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an ndarray. Value: `%s`.', x ) ); + throw new TypeError( format( '1jV4f', x ) ); } if ( isPlainObject( arguments[ nargs-1 ] ) ) { nargs -= 1; options = arguments[ nargs ]; if ( hasOwnProp( options, 'strict' ) ) { if ( !isBoolean( options.strict ) ) { - throw new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'strict', options.strict ) ); + throw new TypeError( format( '1jV2o', 'strict', options.strict ) ); } opts.strict = options.strict; } sh = getShape( x ); if ( nargs === 1 && sh.length > 0 ) { - throw new RangeError( format( 'invalid argument. Number of slice dimensions does not match the number of array dimensions. Array shape: (%s). Slice dimensions: %u.', sh.join( ',' ), 0 ) ); + throw new RangeError( format( '1jVEt', sh.join( ',' ), 0 ) ); } } if ( isMultiSlice( s ) ) { S = s; if ( nargs > 2 ) { - throw new Error( 'invalid invocation. Too many arguments.' ); + throw new Error( format('1jV0m') ); } } else { if ( isArrayLikeObject( s ) ) { args = s; if ( nargs > 2 ) { - throw new Error( 'invalid invocation. Too many arguments.' ); + throw new Error( format('1jV0m') ); } } else { args = []; @@ -139,7 +139,7 @@ function slice( x, s ) { try { new MultiSlice( args[ i ] ); // eslint-disable-line no-new } catch ( err ) { // eslint-disable-line no-unused-vars - throw new TypeError( format( 'invalid argument. Slice arguments must be either a Slice, integer, null, or undefined. Value: `%s`.', String( args[ i ] ) ) ); + throw new TypeError( format( '1jVEu', String( args[ i ] ) ) ); } } } diff --git a/package.json b/package.json index 9a260f7..90f4bfe 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@stdlib/ndarray-shape": "^0.2.2", "@stdlib/slice-base-args2multislice": "^0.2.2", "@stdlib/slice-multi": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/types": "^0.4.3", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" },