Skip to content

Commit

Permalink
fixup! code review
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamingr committed Feb 1, 2021
1 parent d0a4b32 commit 3f712a5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/internal/streams/from.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ function from(Readable, iterable, opts) {
readable._destroy = function(error, cb) {
close(error).then(
() => process.nextTick(cb, error), // nextTick is here in case cb throws
(e) => process.nextTick(cb, error || e),
(e) => process.nextTick(cb, e || error),
);
};

async function close(error) {
const hadError = typeof error !== 'undefined';
const hasThrow = typeof iterator.return === 'function';
const hadError = (error !== undefined) && (error !== null);
const hasThrow = typeof iterator.throw === 'function';
if (hadError && hasThrow) {
const { value, done } = await iterator.throw(error);
await value;
Expand Down

0 comments on commit 3f712a5

Please sign in to comment.