diff --git a/lib/main.js b/lib/main.js index d16f241..edb48a9 100644 --- a/lib/main.js +++ b/lib/main.js @@ -27,7 +27,7 @@ var isCollection = require( '@stdlib/assert-is-collection' ); var base = require( '@stdlib/array-base-put' ); var dtype = require( '@stdlib/array-dtype' ); var convert = require( '@stdlib/array-convert' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var defaults = require( './defaults.js' ); var validate = require( './validate.js' ); @@ -81,13 +81,13 @@ function put( x, indices, values ) { var xdt; var vdt; if ( !isCollection( x ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an array-like object. Value: `%s`.', x ) ); + throw new TypeError( format( 'null2O', x ) ); } if ( !isCollection( indices ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be an array-like object. Value: `%s`.', indices ) ); + throw new TypeError( format( 'null2y', indices ) ); } if ( !isCollection( values ) ) { - throw new TypeError( format( 'invalid argument. Third argument must be an array-like object. Value: `%s`.', values ) ); + throw new TypeError( format( 'null2l', values ) ); } opts = defaults(); if ( arguments.length > 3 ) { diff --git a/lib/validate.js b/lib/validate.js index 4c84a68..0ee8ebb 100644 --- a/lib/validate.js +++ b/lib/validate.js @@ -24,7 +24,7 @@ var isObject = require( '@stdlib/assert-is-plain-object' ); var hasOwnProp = require( '@stdlib/assert-has-own-property' ); var isIndexMode = require( '@stdlib/ndarray-base-assert-is-index-mode' ); var modes = require( '@stdlib/ndarray-index-modes' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -50,12 +50,12 @@ var format = require( '@stdlib/string-format' ); */ function validate( opts, options ) { if ( !isObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + return new TypeError( format( 'null2V', options ) ); } if ( hasOwnProp( options, 'mode' ) ) { opts.mode = options.mode; if ( !isIndexMode( opts.mode ) ) { - return new TypeError( format( 'invalid option. `%s` option must be one of the following: "%s". Option: `%s`.', 'mode', modes().join( '", "' ), opts.mode ) ); + return new TypeError( format( 'null4S', 'mode', modes().join( '", "' ), opts.mode ) ); } } return null; diff --git a/package.json b/package.json index 07b6feb..a04f6f5 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "@stdlib/assert-is-plain-object": "^0.2.3", "@stdlib/ndarray-base-assert-is-index-mode": "^0.2.3", "@stdlib/ndarray-index-modes": "^0.2.3", - "@stdlib/string-format": "^0.2.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.3", "@stdlib/types": "^0.5.1", "@stdlib/error-tools-fmtprodmsg": "^0.2.3" },