summaryrefslogtreecommitdiff
path: root/lib/internal/streams
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2019-03-22 03:44:26 +0100
committerRuben Bridgewater <ruben@bridgewater.de>2019-03-27 17:20:06 +0100
commitb08a867d6016ccf04783a0f91fdbcc3460daf234 (patch)
tree5df4b30220cde5ae5eac9ed956c9badac6ba08af /lib/internal/streams
parentfd992e6e36bb4b01a6ceb71cfeb3bae640b492a6 (diff)
downloadandroid-node-v8-b08a867d6016ccf04783a0f91fdbcc3460daf234.tar.gz
android-node-v8-b08a867d6016ccf04783a0f91fdbcc3460daf234.tar.bz2
android-node-v8-b08a867d6016ccf04783a0f91fdbcc3460daf234.zip
benchmark,doc,lib: capitalize more comments
PR-URL: https://github.com/nodejs/node/pull/26849 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Diffstat (limited to 'lib/internal/streams')
-rw-r--r--lib/internal/streams/async_iterator.js23
1 files changed, 10 insertions, 13 deletions
diff --git a/lib/internal/streams/async_iterator.js b/lib/internal/streams/async_iterator.js
index 0d22e4efee..16d1316b16 100644
--- a/lib/internal/streams/async_iterator.js
+++ b/lib/internal/streams/async_iterator.js
@@ -18,9 +18,7 @@ function readAndResolve(iter) {
const resolve = iter[kLastResolve];
if (resolve !== null) {
const data = iter[kStream].read();
- // we defer if data is null
- // we can be expecting either 'end' or
- // 'error'
+ // We defer if data is null. We can be expecting either 'end' or 'error'.
if (data !== null) {
iter[kLastPromise] = null;
iter[kLastResolve] = null;
@@ -32,7 +30,7 @@ function readAndResolve(iter) {
function onReadable(iter) {
// We wait for the next tick, because it might
- // emit an error with process.nextTick
+ // emit an error with `process.nextTick()`.
process.nextTick(readAndResolve, iter);
}
@@ -59,7 +57,7 @@ const ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf({
next() {
// If we have detected an error in the meanwhile
- // reject straight away
+ // reject straight away.
const error = this[kError];
if (error !== null) {
return Promise.reject(error);
@@ -110,9 +108,9 @@ const ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf({
},
return() {
- // destroy(err, cb) is a private API
- // we can guarantee we have that here, because we control the
- // Readable class this is attached to
+ // destroy(err, cb) is a private API.
+ // We can guarantee we have that here, because we control the
+ // Readable class this is attached to.
return new Promise((resolve, reject) => {
this[kStream].destroy(null, (err) => {
if (err) {
@@ -135,9 +133,8 @@ const createReadableStreamAsyncIterator = (stream) => {
value: stream._readableState.endEmitted,
writable: true
},
- // The function passed to new Promise
- // is cached so we avoid allocating a new
- // closure at every run
+ // The function passed to new Promise is cached so we avoid allocating a new
+ // closure at every run.
[kHandlePromise]: {
value: (resolve, reject) => {
const data = iterator[kStream].read();
@@ -159,8 +156,8 @@ const createReadableStreamAsyncIterator = (stream) => {
finished(stream, (err) => {
if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {
const reject = iterator[kLastReject];
- // Reject if we are waiting for data in the Promise
- // returned by next() and store the error
+ // Reject if we are waiting for data in the Promise returned by next() and
+ // store the error.
if (reject !== null) {
iterator[kLastPromise] = null;
iterator[kLastResolve] = null;