Skip to content

Commit 3d4f608

Browse files
rickyesMylesBorins
authored andcommitted
stream: rename opts to options
PR-URL: #34339 Refs: https://nodejs.org/dist/latest-v14.x/docs/api/stream.html#stream_stream_finished_stream_options_callback Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent c28453a commit 3d4f608

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

lib/internal/streams/end-of-stream.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,25 @@ function isReadableEnded(stream) {
4141
return rState.endEmitted || (rState.ended && rState.length === 0);
4242
}
4343

44-
function eos(stream, opts, callback) {
44+
function eos(stream, options, callback) {
4545
if (arguments.length === 2) {
46-
callback = opts;
47-
opts = {};
48-
} else if (opts == null) {
49-
opts = {};
50-
} else if (typeof opts !== 'object') {
51-
throw new ERR_INVALID_ARG_TYPE('opts', 'object', opts);
46+
callback = options;
47+
options = {};
48+
} else if (options == null) {
49+
options = {};
50+
} else if (typeof options !== 'object') {
51+
throw new ERR_INVALID_ARG_TYPE('options', 'object', options);
5252
}
5353
if (typeof callback !== 'function') {
5454
throw new ERR_INVALID_ARG_TYPE('callback', 'function', callback);
5555
}
5656

5757
callback = once(callback);
5858

59-
const readable = opts.readable ||
60-
(opts.readable !== false && isReadable(stream));
61-
const writable = opts.writable ||
62-
(opts.writable !== false && isWritable(stream));
59+
const readable = options.readable ||
60+
(options.readable !== false && isReadable(stream));
61+
const writable = options.writable ||
62+
(options.writable !== false && isWritable(stream));
6363

6464
const wState = stream._writableState;
6565
const rState = stream._readableState;
@@ -144,7 +144,7 @@ function eos(stream, opts, callback) {
144144

145145
stream.on('end', onend);
146146
stream.on('finish', onfinish);
147-
if (opts.error !== false) stream.on('error', onerror);
147+
if (options.error !== false) stream.on('error', onerror);
148148
stream.on('close', onclose);
149149

150150
const closed = (

test/parallel/test-stream-finished.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ const { promisify } = require('util');
145145
() => finished(rs, 'foo', () => {}),
146146
{
147147
code: 'ERR_INVALID_ARG_TYPE',
148-
message: /opts/
148+
message: /options/
149149
}
150150
);
151151
assert.throws(

0 commit comments

Comments
 (0)