Skip to content

Commit f7d1eb5

Browse files
committed
Transform error messages
1 parent 7cbf4db commit f7d1eb5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/validate.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
var isPlainObject = require( '@stdlib/assert-is-plain-object' );
2424
var hasOwnProp = require( '@stdlib/assert-has-own-property' );
2525
var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;
26-
var format = require( '@stdlib/string-format' );
26+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
2727

2828

2929
// MAIN //
@@ -49,15 +49,15 @@ var format = require( '@stdlib/string-format' );
4949
*/
5050
function validate( opts, options ) {
5151
if ( !isPlainObject( options ) ) {
52-
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
52+
return new TypeError( format( '0aF2V', options ) );
5353
}
5454
if ( hasOwnProp( options, 'iter' ) ) {
5555
opts.iter = options.iter;
5656
if ( !isNonNegativeInteger( options.iter ) ) {
57-
return new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer. Option: `%s`.', 'iter', options.iter ) );
57+
return new TypeError( format( '0aF2t', 'iter', options.iter ) );
5858
}
5959
if ( options.iter > 77 ) {
60-
return new RangeError( format( 'invalid option. `%s` option must be less than or equal to 77. Option: `%u`.', 'iter', options.iter ) );
60+
return new RangeError( format( '0aF4U', 'iter', options.iter ) );
6161
}
6262
}
6363
return null;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@stdlib/assert-has-own-property": "^0.2.1",
4141
"@stdlib/assert-is-nonnegative-integer": "^0.2.1",
4242
"@stdlib/assert-is-plain-object": "^0.2.1",
43-
"@stdlib/string-format": "^0.2.1",
43+
"@stdlib/error-tools-fmtprodmsg": "^0.2.1",
4444
"@stdlib/symbol-iterator": "^0.2.1",
4545
"@stdlib/types": "^0.3.2",
4646
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1"

0 commit comments

Comments
 (0)