@@ -24,7 +24,7 @@ var fdtypes = require( '@stdlib/array-typed-real-float-dtypes' );
2424var rdtypes = require ( '@stdlib/array-typed-real-dtypes' ) ;
2525var isObject = require ( '@stdlib/assert-is-plain-object' ) ;
2626var hasOwnProp = require ( '@stdlib/assert-has-own-property' ) ;
27- var format = require ( '@stdlib/string-format ' ) ;
27+ var format = require ( '@stdlib/error-tools-fmtprodmsg ' ) ;
2828
2929
3030// VARIABLES //
@@ -69,30 +69,30 @@ FDTYPES.push( 'generic' );
6969*/
7070function validate ( opts , options , mode ) {
7171 if ( ! isObject ( options ) ) {
72- return new TypeError ( format ( 'invalid argument. Options argument must be an object. Value: `%s`. ' , options ) ) ;
72+ return new TypeError ( format ( '1eH2V ' , options ) ) ;
7373 }
7474 if ( mode === 0 ) {
7575 if ( hasOwnProp ( options , 'idtype' ) ) {
7676 opts . idtype = options . idtype ;
7777 if ( RDTYPES . indexOf ( opts . idtype ) < 0 ) {
78- return new TypeError ( format ( 'invalid option. `%s` option must be one of the following: "%s". Option: `%s`. ' , 'idtype' , RDTYPES . join ( '", "' ) , opts . idtype ) ) ;
78+ return new TypeError ( format ( '1eH4S ' , 'idtype' , RDTYPES . join ( '", "' ) , opts . idtype ) ) ;
7979 }
8080 }
8181 if ( hasOwnProp ( options , 'ndtype' ) ) {
8282 opts . ndtype = options . ndtype ;
8383 if ( FDTYPES . indexOf ( opts . ndtype ) < 0 ) {
84- return new TypeError ( format ( 'invalid option. `%s` option must be one of the following: "%s". Option: `%s`. ' , 'ndtype' , FDTYPES . join ( '", "' ) , opts . ndtype ) ) ;
84+ return new TypeError ( format ( '1eH4S ' , 'ndtype' , FDTYPES . join ( '", "' ) , opts . ndtype ) ) ;
8585 }
8686 }
8787 } else if ( mode === 1 && hasOwnProp ( options , 'dtype' ) ) {
8888 opts . dtype = options . dtype ;
8989 if ( RDTYPES . indexOf ( opts . dtype ) < 0 ) {
90- return new TypeError ( format ( 'invalid option. `%s` option must be one of the following: "%s". Option: `%s`. ' , 'dtype' , RDTYPES . join ( '", "' ) , opts . dtype ) ) ;
90+ return new TypeError ( format ( '1eH4S ' , 'dtype' , RDTYPES . join ( '", "' ) , opts . dtype ) ) ;
9191 }
9292 } else if ( hasOwnProp ( options , 'dtype' ) ) { // mode === 2
9393 opts . dtype = options . dtype ;
9494 if ( FDTYPES . indexOf ( opts . dtype ) < 0 ) {
95- return new TypeError ( format ( 'invalid option. `%s` option must be one of the following: "%s". Option: `%s`. ' , 'dtype' , FDTYPES . join ( '", "' ) , opts . dtype ) ) ;
95+ return new TypeError ( format ( '1eH4S ' , 'dtype' , FDTYPES . join ( '", "' ) , opts . dtype ) ) ;
9696 }
9797 }
9898 return null ;
0 commit comments