diff options
Diffstat (limited to 'lib/internal/streams/async_iterator.js')
-rw-r--r-- | lib/internal/streams/async_iterator.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/internal/streams/async_iterator.js b/lib/internal/streams/async_iterator.js index 810132c0cb..0d22e4efee 100644 --- a/lib/internal/streams/async_iterator.js +++ b/lib/internal/streams/async_iterator.js @@ -85,10 +85,9 @@ const ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf({ }); } - // if we have multiple next() calls - // we will wait for the previous Promise to finish - // this logic is optimized to support for await loops, - // where next() is only called once at a time + // If we have multiple next() calls we will wait for the previous Promise to + // finish. This logic is optimized to support for await loops, where next() + // is only called once at a time. const lastPromise = this[kLastPromise]; let promise; @@ -96,7 +95,7 @@ const ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf({ promise = new Promise(wrapForNext(lastPromise, this)); } else { // Fast path needed to support multiple this.push() - // without triggering the next() queue + // without triggering the next() queue. const data = this[kStream].read(); if (data !== null) { return Promise.resolve(createIterResult(data, false)); @@ -136,7 +135,7 @@ const createReadableStreamAsyncIterator = (stream) => { value: stream._readableState.endEmitted, writable: true }, - // the function passed to new Promise + // The function passed to new Promise // is cached so we avoid allocating a new // closure at every run [kHandlePromise]: { |