Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions lib/streams.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
* @returns {ReadableStream} Concatenated list
*/
function concatStream(list) {
list = list.map(toStream);

Check warning on line 69 in lib/streams.js

View workflow job for this annotation

GitHub Actions / ESLint

Assignment to function parameter 'list'
const transform = transformWithCancel(async function(reason) {
await Promise.all(transforms.map(stream => cancel(stream, reason)));
});
Expand Down Expand Up @@ -111,7 +111,7 @@
preventCancel = false
} = {}) {
if (isStream(input) && !isArrayStream(input) && !isArrayStream(target)) {
input = toStream(input);

Check warning on line 114 in lib/streams.js

View workflow job for this annotation

GitHub Actions / ESLint

Assignment to function parameter 'input'
try {
if (input[externalBuffer]) {
const writer = getWriter(target);
Expand All @@ -130,7 +130,7 @@
return;
}
if (!isStream(input)) {
input = toArrayStream(input);

Check warning on line 133 in lib/streams.js

View workflow job for this annotation

GitHub Actions / ESLint

Assignment to function parameter 'input'
}
const reader = getReader(input);
const writer = getWriter(target);
Expand Down Expand Up @@ -237,8 +237,7 @@
}
const result1 = process(input);
const result2 = finish();
if (result1 !== undefined && result2 !== undefined) return concat([result1, result2]);
return result1 !== undefined ? result1 : result2;
return concat([result1, result2].filter(result => result !== undefined));
}

/**
Expand All @@ -263,8 +262,7 @@
}
const result1 = await process(input);
const result2 = await finish();
if (result1 !== undefined && result2 !== undefined) return concat([result1, result2]);
return result1 !== undefined ? result1 : result2;
return concat([result1, result2].filter(result => result !== undefined));
}

function _transformStream(input, process, finish, queuingStrategy) {
Expand Down Expand Up @@ -361,7 +359,7 @@
fn(incoming.readable, outgoing.writable);
return outgoing.readable;
}
input = toArrayStream(input);

Check warning on line 362 in lib/streams.js

View workflow job for this annotation

GitHub Actions / ESLint

Assignment to function parameter 'input'
const output = new ArrayStream();
fn(input, output);
return output;
Expand Down Expand Up @@ -568,7 +566,7 @@
return fromAsync(async () => slice(await readToEnd(input), begin, end));
}
if (input[externalBuffer]) {
input = concat(input[externalBuffer].concat([input]));

Check warning on line 569 in lib/streams.js

View workflow job for this annotation

GitHub Actions / ESLint

Assignment to function parameter 'input'
}
if (isUint8Array(input)) {
return input.subarray(begin, end === Infinity ? input.length : end);
Expand Down