@@ -27,7 +27,7 @@ var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;
27
27
var isPositiveInteger = require ( '@stdlib/assert-is-positive-integer' ) . isPrimitive ;
28
28
var isNonNegativeInteger = require ( '@stdlib/assert-is-nonnegative-integer' ) . isPrimitive ;
29
29
var isnan = require ( '@stdlib/math-base-assert-is-nan' ) ;
30
- var format = require ( '@stdlib/string-format ' ) ;
30
+ var format = require ( '@stdlib/error-tools-fmtprodmsg ' ) ;
31
31
32
32
33
33
// MAIN //
@@ -58,42 +58,42 @@ var format = require( '@stdlib/string-format' );
58
58
*/
59
59
function validate ( opts , options ) {
60
60
if ( ! isPlainObject ( options ) ) {
61
- return new TypeError ( format ( 'invalid argument. Options argument must be an object. Value: `%s`. ' , options ) ) ;
61
+ return new TypeError ( format ( '0tT2V ' , options ) ) ;
62
62
}
63
63
if ( hasOwnProp ( options , 'duration' ) ) {
64
64
opts . duration = options . duration ;
65
65
if ( ! isPositiveInteger ( options . duration ) ) {
66
- return new TypeError ( format ( 'invalid option. `%s` option must be a positive integer. Option: `%s`. ' , 'duration' , options . duration ) ) ;
66
+ return new TypeError ( format ( '0tT3P ' , 'duration' , options . duration ) ) ;
67
67
}
68
68
}
69
69
if ( hasOwnProp ( options , 'period' ) ) {
70
70
opts . period = options . period ;
71
71
if ( ! isPositiveInteger ( options . period ) ) {
72
- return new TypeError ( format ( 'invalid option. `%s` option must be a positive integer. Option: `%s`. ' , 'period' , options . period ) ) ;
72
+ return new TypeError ( format ( '0tT3P ' , 'period' , options . period ) ) ;
73
73
}
74
74
}
75
75
if ( hasOwnProp ( options , 'min' ) ) {
76
76
opts . min = options . min ;
77
77
if ( ! isNumber ( options . min ) || isnan ( options . min ) ) {
78
- return new TypeError ( format ( 'invalid option. `%s` option must be a number. Option: `%s`. ' , 'min' , options . min ) ) ;
78
+ return new TypeError ( format ( '0tT8P ' , 'min' , options . min ) ) ;
79
79
}
80
80
}
81
81
if ( hasOwnProp ( options , 'max' ) ) {
82
82
opts . max = options . max ;
83
83
if ( ! isNumber ( options . max ) || isnan ( options . max ) ) {
84
- return new TypeError ( format ( 'invalid option. `%s` option must be a number. Option: `%s`. ' , 'max' , options . max ) ) ;
84
+ return new TypeError ( format ( '0tT8P ' , 'max' , options . max ) ) ;
85
85
}
86
86
}
87
87
if ( hasOwnProp ( options , 'offset' ) ) {
88
88
opts . offset = options . offset ;
89
89
if ( ! isInteger ( options . offset ) ) {
90
- return new TypeError ( format ( 'invalid option. `%s` option must be an integer. Option: `%s`. ' , 'offset' , options . offset ) ) ;
90
+ return new TypeError ( format ( '0tT8M ' , 'offset' , options . offset ) ) ;
91
91
}
92
92
}
93
93
if ( hasOwnProp ( options , 'iter' ) ) {
94
94
opts . iter = options . iter ;
95
95
if ( ! isNonNegativeInteger ( options . iter ) ) {
96
- return new TypeError ( format ( 'invalid option. `%s` option must be a nonnegative integer. Option: `%s`. ' , 'iter' , options . iter ) ) ;
96
+ return new TypeError ( format ( '0tT2t ' , 'iter' , options . iter ) ) ;
97
97
}
98
98
}
99
99
return null ;
0 commit comments