@@ -26,7 +26,7 @@ var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;
2626var isNonNegative = require ( '@stdlib/assert-is-nonnegative-number' ) . isPrimitive ;
2727var isString = require ( '@stdlib/assert-is-string' ) . isPrimitive ;
2828var isFunction = require ( '@stdlib/assert-is-function' ) ;
29- var format = require ( '@stdlib/string-format ' ) ;
29+ var format = require ( '@stdlib/error-tools-fmtprodmsg ' ) ;
3030
3131
3232// MAIN //
@@ -57,42 +57,42 @@ var format = require( '@stdlib/string-format' );
5757*/
5858function validate ( opts , options ) {
5959if ( ! isObject ( options ) ) {
60- return new TypeError ( format ( 'invalid argument. Options argument must be an object. Value: `%s`. ' , options ) ) ;
60+ return new TypeError ( format ( '1M92V ' , options ) ) ;
6161}
6262if ( hasOwnProp ( options , 'sep' ) ) {
6363opts . sep = options . sep ;
6464if ( ! isString ( opts . sep ) ) {
65- return new TypeError ( format ( 'invalid option. `%s` option must be a string. Option: `%s`. ' , 'sep' , opts . sep ) ) ;
65+ return new TypeError ( format ( '1M92W ' , 'sep' , opts . sep ) ) ;
6666}
6767}
6868if ( hasOwnProp ( options , 'objectMode' ) ) {
6969opts . objectMode = options . objectMode ;
7070if ( ! isBoolean ( opts . objectMode ) ) {
71- return new TypeError ( format ( 'invalid option. `%s` option must be a boolean. Option: `%s`. ' , 'objectMode' , opts . objectMode ) ) ;
71+ return new TypeError ( format ( '1M92o ' , 'objectMode' , opts . objectMode ) ) ;
7272}
7373}
7474if ( hasOwnProp ( options , 'encoding' ) ) {
7575opts . encoding = options . encoding ;
7676if ( ! isString ( opts . encoding ) && opts . encoding !== null ) {
77- return new TypeError ( format ( 'invalid option. `%s` option must be a string or null. Option: `%s`. ' , 'encoding' , opts . encoding ) ) ;
77+ return new TypeError ( format ( '1M97n ' , 'encoding' , opts . encoding ) ) ;
7878}
7979}
8080if ( hasOwnProp ( options , 'highWaterMark' ) ) {
8181opts . highWaterMark = options . highWaterMark ;
8282if ( ! isNonNegative ( opts . highWaterMark ) ) {
83- return new TypeError ( format ( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`. ' , 'highWaterMark' , opts . highWaterMark ) ) ;
83+ return new TypeError ( format ( '1M94k ' , 'highWaterMark' , opts . highWaterMark ) ) ;
8484}
8585}
8686if ( hasOwnProp ( options , 'serialize' ) ) {
8787opts . serialize = options . serialize ;
8888if ( ! isFunction ( opts . serialize ) ) {
89- return new TypeError ( format ( 'invalid option. `%s` option must be a function. Option: `%s`. ' , 'serialize' , opts . serialize ) ) ;
89+ return new TypeError ( format ( '1M96p ' , 'serialize' , opts . serialize ) ) ;
9090}
9191}
9292if ( hasOwnProp ( options , 'dir' ) ) {
9393opts . dir = options . dir ;
9494if ( opts . dir !== 1 && opts . dir !== - 1 ) {
95- return new TypeError ( format ( 'invalid option. `%s` option must be either `1` or `-1`. Option: `%s`. ' , 'dir' , opts . dir ) ) ;
95+ return new TypeError ( format ( '1M92v ' , 'dir' , opts . dir ) ) ;
9696}
9797}
9898return null ;