Skip to content

Commit 0bce498

Browse files
benjamingraduh95
authored andcommittedFeb 1, 2021
fixup! code review
1 parent 11fe4f2 commit 0bce498

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎lib/internal/streams/from.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ function from(Readable, iterable, opts) {
5454
PromisePrototypeThen(
5555
close(error),
5656
() => process.nextTick(cb, error), // nextTick is here in case cb throws
57-
(e) => process.nextTick(cb, error || e),
57+
(e) => process.nextTick(cb, e || error),
5858
);
5959
};
6060

6161
async function close(error) {
62-
const hadError = typeof error !== 'undefined';
63-
const hasThrow = typeof iterator.return === 'function';
62+
const hadError = (error !== undefined) && (error !== null);
63+
const hasThrow = typeof iterator.throw === 'function';
6464
if (hadError && hasThrow) {
6565
const { value, done } = await iterator.throw(error);
6666
await value;

0 commit comments

Comments
 (0)