8000 Transform error messages · stdlib-js/utils-async-none-by@ded60cc · GitHub
[go: up one dir, main page]

Skip to content

Commit ded60cc

Browse files
committed
Transform error messages
1 parent ed91ca0 commit ded60cc

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

lib/factory.js

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

2323
var isFunction = require( '@stdlib/assert-is-function' );
2424
var isCollection = require( '@stdlib/assert-is-collection' );
25-
var format = require( '@stdlib/string-format' );
25+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
2626
var PINF = require( '@stdlib/constants-float64-pinf' );
2727
var validate = require( './validate.js' );
2828
var limit = require( './limit.js' );
@@ -109,7 +109,7 @@ function factory( options, predicate ) {
109109
f = options;
110110
}
111111
if ( !isFunction( f ) ) {
112-
throw new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );
112+
throw new TypeError( format( '1RV3q', f ) );
113113
}
114114
if ( opts.series ) {
115115
opts.limit = 1;
@@ -130,10 +130,10 @@ function factory( options, predicate ) {
130130
*/
131131
function noneByAsync( collection, done ) {
132132
if ( !isCollection( collection ) ) {
133-
throw new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );
133+
throw new TypeError( format( '1RVAh', collection ) );
134134
}
135135
if ( !isFunction( done ) ) {
136-
throw new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );
136+
throw new TypeError( format( '1RV3q', done ) );
137137
}
138138
return limit( collection, opts, f, clbk );
139139

lib/validate.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var isObject = require( '@stdlib/assert-is-plain-object' );
2424
var hasOwnProp = require( '@stdlib/assert-has-own-property' );
2525
var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;
2626
var isPositiveInteger = require( '@stdlib/assert-is-positive-integer' ).isPrimitive;
27-
var format = require( '@stdlib/string-format' );
27+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
2828

2929

3030
// MAIN //
@@ -54,21 +54,21 @@ var format = require( '@stdlib/string-format' );
5454
*/
5555
function validate( opts, options ) {
5656
if ( !isObject( options ) ) {
57-
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
57+
return new TypeError( format( '1RV2V', options ) );
5858
}
5959
if ( hasOwnProp( options, 'thisArg' ) ) {
6060
opts.thisArg = options.thisArg;
6161
}
6262
if ( hasOwnProp( options, 'series' ) ) {
6363
opts.series = options.series;
6464
if ( !isBoolean( opts.series ) ) {
65-
return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );
65+
return new TypeError( format( '1RV2o', 'series', opts.series ) );
6666
}
6767
}
6868
if ( hasOwnProp( options, 'limit' ) ) {
6969
opts.limit = options.limit;
7070
if ( !isPositiveInteger( opts.limit ) ) {
71-
return new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );
71+
return new TypeError( format( '1RV3P', 'limit', opts.limit ) );
7272
}
7373
}
7474
return null;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"@stdlib/assert-is-plain-object": "^0.2.2",
4545
"@stdlib/assert-is-positive-integer": "^0.2.2",
4646
"@stdlib/constants-float64-pinf": "^0.2.2",
47-
"@stdlib/string-format": "^0.2.2",
47+
"@stdlib/error-tools-fmtprodmsg": "^0.2.2",
4848
"@stdlib/types": "^0.4.3",
4949
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2",
5050
"debug": "^2.6.9",

0 commit comments

Comments
 (0)
0