@@ -26,7 +26,7 @@ var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;
26
26
var isNonNegative = require ( '@stdlib/assert-is-nonnegative-number' ) . isPrimitive ;
27
27
var isString = require ( '@stdlib/assert-is-string' ) . isPrimitive ;
28
28
var isRegExp = require ( '@stdlib/assert-is-regexp' ) ;
29
- var format = require ( '@stdlib/string-format ' ) ;
29
+ var format = require ( '@stdlib/error-tools-fmtprodmsg ' ) ;
30
30
31
31
32
32
// MAIN //
@@ -58,45 +58,45 @@ var format = require( '@stdlib/string-format' );
58
58
*/
59
59
function validate ( opts , options ) {
60
60
if ( ! isObject ( options ) ) {
61
- return new TypeError ( format ( 'invalid argument. Options argument must be an object. Value: `%s`. ' , options ) ) ;
61
+ return new TypeError ( format ( '1MR2V ' , options ) ) ;
62
62
}
63
63
if ( hasOwnProp ( options , 'sep' ) ) {
64
64
opts . sep = options . sep ;
65
65
if (
66
66
! isString ( opts . sep ) &&
67
67
! isRegExp ( opts . sep )
68
68
) {
69
- return new TypeError ( format ( 'invalid option. `%s` option must be either a string or a regular expression. Option: `%s`. ' , 'sep' , opts . sep ) ) ;
69
+ return new TypeError ( format ( '1MRAB ' , 'sep' , opts . sep ) ) ;
70
70
}
71
71
}
72
72
if ( hasOwnProp ( options , 'objectMode' ) ) {
73
73
opts . objectMode = options . objectMode ;
74
74
if ( ! isBoolean ( opts . objectMode ) ) {
75
- return new TypeError ( format ( 'invalid option. `%s` option must be a boolean. Option: `%s`. ' , 'objectMode' , opts . objectMode ) ) ;
75
+ return new TypeError ( format ( '1MR2o ' , 'objectMode' , opts . objectMode ) ) ;
76
76
}
77
77
}
78
78
if ( hasOwnProp ( options , 'writableObjectMode' ) ) {
79
79
opts . writableObjectMode = options . writableObjectMode ;
80
80
if ( ! isBoolean ( opts . writableObjectMode ) ) {
81
- return new TypeError ( format ( 'invalid option. `%s` option must be a boolean. Option: `%s`. ' , 'writableObjectMode' , opts . writableObjectMode ) ) ;
81
+ return new TypeError ( format ( '1MR2o ' , 'writableObjectMode' , opts . writableObjectMode ) ) ;
82
82
}
83
83
}
84
84
if ( hasOwnProp ( options , 'encoding' ) ) {
85
85
opts . encoding = options . encoding ;
86
86
if ( ! isString ( opts . encoding ) ) {
87
- return new TypeError ( format ( 'invalid option. `%s` option must be a string. Option: `%s`. ' , 'encoding' , opts . encoding ) ) ;
87
+ return new TypeError ( format ( '1MR2W ' , 'encoding' , opts . encoding ) ) ;
88
88
}
89
89
}
90
90
if ( hasOwnProp ( options , 'allowHalfOpen' ) ) {
91
91
opts . allowHalfOpen = options . allowHalfOpen ;
92
92
if ( ! isBoolean ( opts . allowHalfOpen ) ) {
93
- return new TypeError ( format ( 'invalid option. `%s` option must be a boolean. Option: `%s`. ' , 'allowHalfOpen' , opts . allowHalfOpen ) ) ;
93
+ return new TypeError ( format ( '1MR2o ' , 'allowHalfOpen' , opts . allowHalfOpen ) ) ;
94
94
}
95
95
}
96
96
if ( hasOwnProp ( options , 'highWaterMark' ) ) {
97
97
opts . highWaterMark = options . highWaterMark ;
98
98
if ( ! isNonNegative ( opts . highWaterMark ) ) {
99
- return new TypeError ( format ( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`. ' , 'highWaterMark' , opts . highWaterMark ) ) ;
99
+ return new TypeError ( format ( '1MR4k ' , 'highWaterMark' , opts . highWaterMark ) ) ;
100
100
}
101
101
}
102
102
return null ;
0 commit comments