Skip to content

Commit 3f712a5

Browse files
committed
fixup! code review
1 parent d0a4b32 commit 3f712a5

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
@@ -52,13 +52,13 @@ function from(Readable, iterable, opts) {
5252
readable._destroy = function(error, cb) {
5353
close(error).then(
5454
() => process.nextTick(cb, error), // nextTick is here in case cb throws
55-
(e) => process.nextTick(cb, error || e),
55+
(e) => process.nextTick(cb, e || error),
5656
);
5757
};
5858

5959
async function close(error) {
60-
const hadError = typeof error !== 'undefined';
61-
const hasThrow = typeof iterator.return === 'function';
60+
const hadError = (error !== undefined) && (error !== null);
61+
const hasThrow = typeof iterator.throw === 'function';
6262
if (hadError && hasThrow) {
6363
const { value, done } = await iterator.throw(error);
6464
await value;

0 commit comments

Comments
 (0)