diff --git a/lib/factory.js b/lib/factory.js index 1070595..1b5acc5 100644 --- a/lib/factory.js +++ b/lib/factory.js @@ -22,7 +22,7 @@ var isFunction = require( '@stdlib/assert-is-function' ); var isCollection = require( '@stdlib/assert-is-collection' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var PINF = require( '@stdlib/constants-float64-pinf' ); var validate = require( './validate.js' ); var limit = require( './limit.js' ); @@ -109,7 +109,7 @@ function factory( options, fcn ) { f = options; } if ( !isFunction( f ) ) { - throw new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) ); + throw new TypeError( format( '1Rb3q', f ) ); } if ( opts.series === void 0 && opts.limit === void 0 ) { opts.series = true; @@ -134,10 +134,10 @@ function factory( options, fcn ) { */ function reduceAsync( collection, initial, done ) { if ( !isCollection( collection ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) ); + throw new TypeError( format( '1RbAh', collection ) ); } if ( !isFunction( done ) ) { - throw new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) ); + throw new TypeError( format( '1Rb3q', done ) ); } return limit( collection, initial, opts, f, clbk ); diff --git a/lib/validate.js b/lib/validate.js index 9ba927e..7f6ee29 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; var isPositiveInteger = require( '@stdlib/assert-is-positive-integer' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -54,7 +54,7 @@ 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( '1Rb2V', options ) ); } if ( hasOwnProp( options, 'thisArg' ) ) { opts.thisArg = options.thisArg; @@ -62,13 +62,13 @@ function validate( opts, options ) { if ( hasOwnProp( options, 'series' ) ) { opts.series = options.series; if ( !isBoolean( opts.series ) ) { - return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) ); + return new TypeError( format( '1Rb2o', 'series', opts.series ) ); } } if ( hasOwnProp( options, 'limit' ) ) { opts.limit = options.limit; if ( !isPositiveInteger( opts.limit ) ) { - return new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) ); + return new TypeError( format( '1Rb3P', 'limit', opts.limit ) ); } } return null; diff --git a/package.json b/package.json index d19ae29..8b43a45 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "@stdlib/assert-is-plain-object": "^0.2.2", "@stdlib/assert-is-positive-integer": "^0.2.2", "@stdlib/constants-float64-pinf": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/types": "^0.4.3", "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", "debug": "^2.6.9",