8000 Transform error messages · stdlib-js/streams-node-debug@ff94792 · GitHub
[go: up one dir, main page]

Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

lib/factory.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// MODULES //
2222

2323
var isObject = require( '@stdlib/assert-is-plain-object' );
24-
var format = require( '@stdlib/string-format' );
24+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
2525
var assign = require( '@stdlib/object-assign' );
2626
var Stream = require( './main.js' );
2727

@@ -58,7 +58,7 @@ function streamFactory( options ) {
5858
var opts;
5959
if ( arguments.length ) {
6060
if ( !isObject( options ) ) {
61-
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
61+
throw new TypeError( format( '1M52V', options ) );
6262
}
6363
opts = assign( {}, options );
6464
} else {

lib/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
var InspectStream = require( '@stdlib/streams-node-inspect' );
2424
var isFunction = require( '@stdlib/assert-is-function' );
2525
var isBuffer = require( '@stdlib/assert-is-buffer' );
26-
var format = require( '@stdlib/string-format' );
26+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
2727
var assign = require( '@stdlib/object-assign' );
2828
var inherit = require( '@stdlib/utils-inherit' );
2929
var debug = require( './debug.js' );
@@ -78,7 +78,7 @@ function DebugStream( options, clbk ) {
7878
opts = assign( {}, DEFAULTS );
7979
if ( arguments.length > 1 ) {
8080
if ( !isFunction( clbk ) ) {
81-
throw new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) );
81+
throw new TypeError( format( '1M52b', clbk ) );
8282
}
8383
cb = clbk;
8484
err = validate( opts, options );

lib/object_mode.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
var isFunction = require( '@stdlib/assert-is-function' );
2424
var isObject = require( '@stdlib/assert-is-plain-object' );
25-
var format = require( '@stdlib/string-format' );
25+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
2626
var assign = require( '@stdlib/object-assign' );
2727
var Stream = require( './main.js' );
2828

@@ -58,20 +58,20 @@ function objectMode( options, clbk ) {
5858
var cb;
5959
if ( arguments.length > 1 ) {
6060
if ( !isObject( options ) ) {
61-
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
61+
throw new TypeError( format( '1M52V', options ) );
6262
}
6363
opts = assign( {}, options );
6464
cb = clbk;
6565
if ( !isFunction( clbk ) ) {
66-
throw new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) );
66+
throw new TypeError( format( '1M52b', clbk ) );
6767
}
6868
} else if ( arguments.length ) {
6969
if ( isFunction( 6D40 options ) ) {
7070
opts = {};
7171
cb = options;
7272
} else {
7373
if ( !isObject( options ) ) {
74-
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
74+
throw new TypeError( format( '1M52V', options ) );
7575
}
7676
opts = assign( {}, options );
7777
}

lib/validate.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var hasOwnProp = require( '@stdlib/assert-has-own-property' );
2525
var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;
2626
var isNonNegative = require( '@stdlib/assert-is-nonnegative-number' ).isPrimitive;
2727
var isString = require( '@stdlib/assert-is-string' ).isPrimitive;
28-
var format = require( '@stdlib/string-format' );
28+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
2929

3030

3131
// MAIN //
@@ -45,36 +45,36 @@ var format = require( '@stdlib/string-format' );
4545
*/
4646
function validate( opts, options ) {
4747
if ( !isObject( options ) ) {
48-
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
48+
return new TypeError( format( '1M52V', options ) );
4949
}
5050
if ( hasOwnProp( options, 'name' ) ) {
5151
opts.name = options.name;
5252
if ( !isString( opts.name ) ) {
53-
return new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'name', opts.name ) );
53+
return new TypeError( format( '1M52W', 'name', opts.name ) );
5454
}
5555
}
5656
if ( hasOwnProp( options, 'objectMode' ) ) {
5757
opts.objectMode = options.objectMode;
5858
if ( !isBoolean( opts.objectMode ) ) {
59-
return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );
59+
return new TypeError( format( '1M52o', 'objectMode', opts.objectMode ) );
6060
}
6161
}
6262
if ( hasOwnProp( options, 'readableObjectMode' ) ) {
6363
opts.readableObjectMode = options.readableObjectMode;
6464
if ( !isBoolean( opts.readableObjectMode ) ) {
65-
return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'readableObjectMode', opts.readableObjectMode ) );
65+
return new TypeError( format( '1M52o', 'readableObjectMode', opts.readableObjectMode ) );
6666
}
6767
}
6868
if ( hasOwnProp( options, 'allowHalfOpen' ) ) {
6969
opts.allowHalfOpen = options.allowHalfOpen;
7070
if ( !isBoolean( opts.allowHalfOpen ) ) {
71-
return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'allowHalfOpen', opts.allowHalfOpen ) );
71+
return new TypeError( format( '1M52o', 'allowHalfOpen', opts.allowHalfOpen ) );
7272
}
7373
}
7474
if ( hasOwnProp( options, 'highWaterMark' ) ) {
7575
opts.highWaterMark = options.highWaterMark;
7676
if ( !isNonNegative( opts.highWaterMark ) ) {
77-
return new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );
77+
return new TypeError( format( '1M54k', 'highWaterMark', opts.highWaterMark ) );
7878
}
7979
}
8080
return null;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"@stdlib/assert-is-string": "^0.2.2",
47 674E 47
"@stdlib/object-assign": "^0.2.2",
4848
"@stdlib/streams-node-inspect": "^0.2.2",
49-
"@stdlib/string-format": "^0.2.2",
49+
"@stdlib/error-tools-fmtprodmsg": "^0.2.2",
5050
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2",
5151
"@stdlib/utils-inherit": "^0.2.2",
5252
"debug": "^2.6.9",

0 commit comments

Comments
 (0)
0