Skip to content

Commit efff997

Browse files
committed
stream: apply review comments from #62556
Add eslint-disable-line require-yield for generator that intentionally doesn't yield (throws error instead). Add __proto__: null in duplexify.js object literal as suggested by reviewer. Use yield* source instead of for-await loop in second transform.
1 parent 25ae47b commit efff997

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

lib/internal/streams/duplexify.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ function fromAsyncGen(fn) {
247247
if (resolve !== null) {
248248
const _resolve = resolve;
249249
resolve = null;
250-
_resolve({ done: true, cb() {} });
250+
_resolve({ __proto__: null, done: true, cb() {} });
251251
}
252252

253253
cb(err);

test/parallel/test-stream-readable-compose.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,13 @@ const assert = require('assert');
119119
{
120120
// Errors from nested `.compose()` calls should propagate instead of hanging.
121121
const stream = Readable.from(['hello'])
122-
.compose(async function *(source) {
122+
.compose(async function *(source) { // eslint-disable-line require-yield
123123
for await (const chunk of source) {
124124
throw new Error(`boom: ${chunk}`);
125125
}
126126
})
127127
.compose(async function *(source) {
128-
for await (const chunk of source) {
129-
yield chunk;
130-
}
128+
yield* source;
131129
});
132130

133131
assert.rejects(

0 commit comments

Comments
 (0)