Skip to content

Commit 5aa52e9

Browse files
committed
Auto-generated commit
1 parent 0a8474b commit 5aa52e9

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -306,20 +306,20 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
306306
307307
-->
308308

309-
[umd]: https://github.com/umdjs/umd
310-
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
311-
312-
[deno-url]: https://github.com/stdlib-js/streams-node-from-array/tree/deno
313-
[umd-url]: https://github.com/stdlib-js/streams-node-from-array/tree/umd
314-
[esm-url]: https://github.com/stdlib-js/streams-node-from-array/tree/esm
315-
316309
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
317310
[chat-url]: https://gitter.im/stdlib-js/stdlib/
318311

319312
[stdlib]: https://github.com/stdlib-js/stdlib
320313

321314
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
322315

316+
[umd]: https://github.com/umdjs/umd
317+
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
318+
319+
[deno-url]: https://github.com/stdlib-js/streams-node-from-array/tree/deno
320+
[umd-url]: https://github.com/stdlib-js/streams-node-from-array/tree/umd
321+
[esm-url]: https://github.com/stdlib-js/streams-node-from-array/tree/esm
322+
323323
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/streams-node-from-array/main/LICENSE
324324

325325
[stream]: https://nodejs.org/api/stream.html

lib/validate.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ 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;
2828
var isFunction = require( '@stdlib/assert-is-function' );
29+
var format = require( '@stdlib/string-format' );
2930

3031

3132
// MAIN //
@@ -56,42 +57,42 @@ var isFunction = require( '@stdlib/assert-is-function' );
5657
*/
5758
function validate( opts, options ) {
5859
if ( !isObject( options ) ) {
59-
return new TypeError( 'invalid argument. Options must be an object. Value: `' + options + '`.' );
60+
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
6061
}
6162
if ( hasOwnProp( options, 'sep' ) ) {
6263
opts.sep = options.sep;
6364
if ( !isString( opts.sep ) ) {
64-
return new TypeError( 'invalid option. `sep` option must be a primitive string. Option: `' + opts.sep + '`.' );
65+
return new TypeError( format( 'invalid option. `%s` option must be a string primitive. Option: `%s`.', 'sep', opts.sep ) );
6566
}
6667
}
6768
if ( hasOwnProp( options, 'objectMode' ) ) {
6869
opts.objectMode = options.objectMode;
6970
if ( !isBoolean( opts.objectMode ) ) {
70-
return new TypeError( 'invalid option. `objectMode` option must be a primitive boolean. Option: `' + opts.objectMode + '`.' );
71+
return new TypeError( format( 'invalid option. `%s` option must be a primitive boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );
7172
}
7273
}
7374
if ( hasOwnProp( options, 'encoding' ) ) {
7475
opts.encoding = options.encoding;
7576
if ( !isString( opts.encoding ) && opts.encoding !== null ) {
76-
return new TypeError( 'invalid option. `encoding` option must be a primitive string or null. Option: `' + opts.encoding + '`.' );
77+
return new TypeError( format( 'invalid option. `%s` option must be a string primitive or null. Option: `%s`.', 'encoding', opts.encoding ) );
7778
}
7879
}
7980
if ( hasOwnProp( options, 'highWaterMark' ) ) {
8081
opts.highWaterMark = options.highWaterMark;
8182
if ( !isNonNegative( opts.highWaterMark ) ) {
82-
return new TypeError( 'invalid option. `highWaterMark` option must be a nonnegative number. Option: `' + opts.highWaterMark + '`.' );
83+
return new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );
8384
}
8485
}
8586
if ( hasOwnProp( options, 'serialize' ) ) {
8687
opts.serialize = options.serialize;
8788
if ( !isFunction( opts.serialize ) ) {
88-
return new TypeError( 'invalid option. `serialize` option must be a function. Option: `' + opts.serialize + '`.' );
89+
return new TypeError( format( 'invalid option. `%s` option must be a function. Option: `%s`.', 'serialize', opts.serialize ) );
8990
}
9091
}
9192
if ( hasOwnProp( options, 'dir' ) ) {
9293
opts.dir = options.dir;
9394
if ( opts.dir !== 1 && opts.dir !== -1 ) {
94-
return new TypeError( 'invalid option. `dir` option must be either `1` or `-1`. Option: `' + opts.dir + '`.' );
95+
return new TypeError( format( 'invalid option. `%s` option must be either `1` or `-1`. Option: `%s`.', 'dir', opts.dir ) );
9596
}
9697
}
9798
return null;

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stdlib/streams-node-from-array",
3-
"version": "0.0.6",
3+
"version": "0.0.0",
44
"description": "Create a readable stream from an array-like object.",
55
"license": "Apache-2.0",
66
"author": {
@@ -48,6 +48,7 @@
4848
"@stdlib/assert-is-string": "^0.0.x",
4949
"@stdlib/buffer-ctor": "^0.0.x",
5050
"@stdlib/buffer-from-string": "^0.0.x",
51+
"@stdlib/string-format": "^0.0.x",
5152
"@stdlib/types": "^0.0.x",
5253
"@stdlib/utils-copy": "^0.0.x",
5354
"@stdlib/utils-define-nonenumerable-property": "^0.0.x",

0 commit comments

Comments
 (0)