Skip to content
Permalink
Browse files

benchmark,doc,lib: capitalize more comments

PR-URL: #26849
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
  • Loading branch information...
BridgeAR committed Mar 22, 2019
1 parent fd992e6 commit b08a867d6016ccf04783a0f91fdbcc3460daf234
Showing with 466 additions and 473 deletions.
  1. +1 −1 benchmark/_cli.js
  2. +1 −1 benchmark/common.js
  3. +1 −1 benchmark/crypto/hash-stream-creation.js
  4. +1 −1 benchmark/crypto/hash-stream-throughput.js
  5. +1 −1 benchmark/fixtures/simple-http-server.js
  6. +1 −1 benchmark/http/cluster.js
  7. +1 −1 benchmark/http/incoming_headers.js
  8. +1 −1 benchmark/http/simple.js
  9. +1 −1 benchmark/net/net-c2s-cork.js
  10. +1 −1 benchmark/net/net-c2s.js
  11. +1 −1 benchmark/net/net-pipe.js
  12. +1 −1 benchmark/net/net-s2c.js
  13. +1 −1 benchmark/net/net-wrap-js-stream-passthrough.js
  14. +3 −3 benchmark/url/legacy-vs-whatwg-url-parse.js
  15. +1 −1 benchmark/url/url-searchparams-sort.js
  16. +1 −1 doc/api/cluster.md
  17. +2 −2 doc/api/console.md
  18. +5 −7 doc/api/domain.md
  19. +2 −2 doc/api/errors.md
  20. +1 −1 doc/api/events.md
  21. +8 −8 doc/api/http.md
  22. +1 −1 doc/api/http2.md
  23. +2 −2 doc/api/process.md
  24. +1 −1 doc/api/querystring.md
  25. +3 −3 doc/api/stream.md
  26. +1 −1 doc/api/timers.md
  27. +1 −1 doc/api/util.md
  28. +1 −1 doc/api/zlib.md
  29. +4 −4 lib/_http_server.js
  30. +2 −2 lib/_stream_duplex.js
  31. +6 −7 lib/_stream_readable.js
  32. +5 −5 lib/_stream_writable.js
  33. +1 −1 lib/buffer.js
  34. +1 −1 lib/dgram.js
  35. +2 −2 lib/domain.js
  36. +6 −6 lib/fs.js
  37. +1 −1 lib/internal/child_process.js
  38. +8 −8 lib/internal/freeze_intrinsics.js
  39. +2 −2 lib/internal/fs/streams.js
  40. +2 −2 lib/internal/modules/cjs/loader.js
  41. +1 −1 lib/internal/modules/esm/translators.js
  42. +3 −3 lib/internal/process/per_thread.js
  43. +2 −2 lib/internal/readline.js
  44. +10 −13 lib/internal/streams/async_iterator.js
  45. +1 −1 lib/internal/timers.js
  46. +1 −1 lib/internal/trace_events_async_hooks.js
  47. +4 −4 lib/internal/url.js
  48. +1 −1 lib/net.js
  49. +13 −13 lib/readline.js
  50. +6 −6 lib/repl.js
  51. +5 −6 lib/url.js
  52. +1 −1 lib/zlib.js
  53. +1 −1 test/addons/openssl-client-cert-engine/test.js
  54. +1 −1 test/async-hooks/test-async-await.js
  55. +2 −2 test/async-hooks/test-graph.signal.js
  56. +4 −4 test/async-hooks/test-graph.statwatcher.js
  57. +2 −2 test/async-hooks/test-immediate.js
  58. +2 −2 test/async-hooks/test-statwatcher.js
  59. +1 −1 test/async-hooks/test-timers.setTimeout.js
  60. +1 −1 test/async-hooks/test-ttywrap.readstream.js
  61. +1 −1 test/async-hooks/test-ttywrap.writestream.js
  62. +1 −1 test/common/index.js
  63. +1 −1 test/es-module/test-esm-preserve-symlinks-main.js
  64. +2 −2 test/js-native-api/test_general/test.js
  65. +1 −1 test/js-native-api/test_number/test.js
  66. +1 −1 test/js-native-api/test_string/test.js
  67. +1 −1 test/js-native-api/test_symbol/test1.js
  68. +1 −1 test/js-native-api/test_symbol/test2.js
  69. +1 −1 test/js-native-api/test_symbol/test3.js
  70. +1 −1 test/known_issues/test-vm-ownkeys.js
  71. +1 −1 test/known_issues/test-vm-ownpropertynames.js
  72. +1 −1 test/known_issues/test-vm-ownpropertysymbols.js
  73. +1 −1 test/message/throw_custom_error.js
  74. +1 −1 test/message/throw_non_error.js
  75. +1 −1 test/parallel/test-assert-deep.js
  76. +3 −3 test/parallel/test-buffer-alloc.js
  77. +1 −1 test/parallel/test-buffer-compare-offset.js
  78. +1 −1 test/parallel/test-buffer-copy.js
  79. +3 −3 test/parallel/test-buffer-includes.js
  80. +3 −3 test/parallel/test-buffer-indexof.js
  81. +1 −1 test/parallel/test-buffer-iterator.js
  82. +3 −3 test/parallel/test-buffer-slow.js
  83. +1 −1 test/parallel/test-child-process-constructor.js
  84. +3 −3 test/parallel/test-child-process-disconnect.js
  85. +2 −2 test/parallel/test-child-process-exec-error.js
  86. +1 −1 test/parallel/test-child-process-fork-net-server.js
  87. +1 −1 test/parallel/test-child-process-fork-net.js
  88. +1 −1 test/parallel/test-child-process-spawnsync-input.js
  89. +1 −1 test/parallel/test-child-process-stdio-inherit.js
  90. +1 −1 test/parallel/test-cluster-bind-twice.js
  91. +1 −1 test/parallel/test-cluster-disconnect.js
  92. +1 −1 test/parallel/test-cluster-eaccess.js
  93. +3 −3 test/parallel/test-cluster-master-kill.js
  94. +1 −1 test/parallel/test-cluster-worker-exit.js
  95. +1 −1 test/parallel/test-cluster-worker-kill.js
  96. +2 −2 test/parallel/test-console.js
  97. +1 −1 test/parallel/test-crypto-cipher-decipher.js
  98. +1 −1 test/parallel/test-crypto-cipheriv-decipheriv.js
  99. +1 −1 test/parallel/test-crypto-dh.js
  100. +1 −1 test/parallel/test-crypto-keygen.js
  101. +1 −1 test/parallel/test-crypto-padding-aes256.js
  102. +3 −3 test/parallel/test-crypto-scrypt.js
  103. +1 −1 test/parallel/test-debugger-pid.js
  104. +2 −2 test/parallel/test-dgram-bind.js
  105. +1 −1 test/parallel/test-dgram-close-in-listening.js
  106. +1 −1 test/parallel/test-dgram-close-is-not-callback.js
  107. +1 −1 test/parallel/test-dgram-close.js
  108. +1 −1 test/parallel/test-file-write-stream2.js
  109. +2 −2 test/parallel/test-fs-error-messages.js
  110. +2 −2 test/parallel/test-fs-mkdir.js
  111. +5 −5 test/parallel/test-fs-promises.js
  112. +1 −1 test/parallel/test-fs-realpath-on-substed-drive.js
  113. +1 −1 test/parallel/test-fs-realpath.js
  114. +1 −1 test/parallel/test-http-agent-getname.js
  115. +1 −1 test/parallel/test-http-agent-keepalive.js
  116. +1 −1 test/parallel/test-http-client-override-global-agent.js
  117. +1 −1 test/parallel/test-http-client-timeout-agent.js
  118. +1 −1 test/parallel/test-http-many-ended-pipelines.js
  119. +2 −2 test/parallel/test-http-outgoing-internal-headers.js
  120. +6 −6 test/parallel/test-http-res-write-end-dont-take-array.js
  121. +1 −1 test/parallel/test-http-set-cookies.js
  122. +1 −1 test/parallel/test-http-slow-headers-keepalive.js
  123. +1 −1 test/parallel/test-http-url.parse-auth-with-header-in-request.js
  124. +1 −1 test/parallel/test-http-url.parse-auth.js
  125. +2 −2 test/parallel/test-http-url.parse-basic.js
  126. +2 −2 test/parallel/test-http-url.parse-https.request.js
  127. +2 −2 test/parallel/test-http-url.parse-path.js
  128. +1 −1 test/parallel/test-http-url.parse-post.js
  129. +1 −1 test/parallel/test-http-url.parse-search.js
  130. +1 −1 test/parallel/test-http-write-callbacks.js
  131. +1 −1 test/parallel/test-http2-binding.js
  132. +4 −4 test/parallel/test-http2-client-destroy.js
  133. +2 −2 test/parallel/test-http2-client-socket-destroy.js
  134. +5 −5 test/parallel/test-http2-compat-serverresponse-end.js
  135. +1 −1 test/parallel/test-http2-compat-serverresponse-flushheaders.js
  136. +1 −1 test/parallel/test-http2-compat-write-head-destroyed.js
  137. +1 −1 test/parallel/test-http2-connect.js
  138. +1 −1 test/parallel/test-http2-head-request.js
  139. +1 −1 test/parallel/test-http2-session-settings.js
  140. +2 −2 test/parallel/test-http2-session-unref.js
  141. +3 −3 test/parallel/test-https-agent-create-connection.js
  142. +1 −1 test/parallel/test-https-agent-getname.js
  143. +1 −1 test/parallel/test-https-argument-of-creating.js
  144. +1 −1 test/parallel/test-https-client-override-global-agent.js
  145. +2 −2 test/parallel/test-https-client-renegotiation-limit.js
  146. +1 −1 test/parallel/test-https-strict.js
  147. +1 −1 test/parallel/test-https-timeout.js
  148. +1 −1 test/parallel/test-icu-punycode.js
  149. +5 −5 test/parallel/test-intl.js
  150. +1 −1 test/parallel/test-listen-fd-cluster.js
  151. +1 −1 test/parallel/test-listen-fd-detached-inherit.js
  152. +1 −1 test/parallel/test-listen-fd-detached.js
  153. +1 −1 test/parallel/test-listen-fd-server.js
  154. +1 −1 test/parallel/test-microtask-queue-run-immediate.js
  155. +1 −1 test/parallel/test-microtask-queue-run.js
  156. +1 −1 test/parallel/test-net-can-reset-timeout.js
  157. +1 −1 test/parallel/test-net-connect-memleak.js
  158. +1 −1 test/parallel/test-net-pingpong.js
  159. +3 −3 test/parallel/test-net-server-listen-handle.js
  160. +1 −1 test/parallel/test-net-server-unref-persistent.js
  161. +1 −1 test/parallel/test-net-socket-local-address.js
  162. +1 −1 test/parallel/test-path-relative.js
  163. +1 −1 test/parallel/test-process-kill-pid.js
  164. +1 −1 test/parallel/test-process-raw-debug.js
  165. +1 −1 test/parallel/test-promises-unhandled-proxy-rejections.js
  166. +1 −1 test/parallel/test-promises-unhandled-symbol-rejections.js
  167. +1 −1 test/parallel/test-querystring-escape.js
  168. +4 −4 test/parallel/test-querystring.js
  169. +5 −5 test/parallel/test-readline-interface.js
  170. +17 −17 test/parallel/test-readline-keys.js
  171. +1 −1 test/parallel/test-repl-autolibs.js
  172. +1 −1 test/parallel/test-repl-context.js
  173. +1 −1 test/parallel/test-repl-end-emits-exit.js
  174. +2 −2 test/parallel/test-repl-options.js
  175. +1 −1 test/parallel/test-repl-save-load.js
  176. +1 −1 test/parallel/test-repl-tab-complete.js
  177. +3 −3 test/parallel/test-repl.js
  178. +1 −1 test/parallel/test-require-extension-over-directory.js
  179. +2 −2 test/parallel/test-require-symlink.js
  180. +3 −3 test/parallel/test-stream-big-push.js
  181. +2 −2 test/parallel/test-stream-finished.js
  182. +1 −1 test/parallel/test-stream-readable-destroy.js
  183. +1 −1 test/parallel/test-stream-readable-event.js
  184. +1 −1 test/parallel/test-stream-readable-pause-and-resume.js
  185. +4 −4 test/parallel/test-stream-readable-reading-readingMore.js
  186. +3 −3 test/parallel/test-stream-transform-split-highwatermark.js
  187. +1 −1 test/parallel/test-stream-unshift-read-race.js
  188. +1 −1 test/parallel/test-stream-writable-destroy.js
  189. +1 −1 test/parallel/test-stream-writableState-ending.js
  190. +2 −2 test/parallel/test-stream-writableState-uncorked-bufferedRequestCount.js
  191. +1 −1 test/parallel/test-stream2-push.js
  192. +2 −2 test/parallel/test-stream2-readable-from-list.js
  193. +2 −2 test/parallel/test-stream2-readable-non-empty-end.js
  194. +2 −2 test/parallel/test-stream2-transform.js
  195. +6 −6 test/parallel/test-stream2-writable.js
  196. +9 −9 test/parallel/test-stream3-pause-then-read.js
  197. +1 −1 test/parallel/test-string-decoder-end.js
  198. +5 −5 test/parallel/test-stringbytes-external.js
  199. +1 −1 test/parallel/test-timers-ordering.js
  200. +1 −1 test/parallel/test-timers-uncaught-exception.js
  201. +4 −4 test/parallel/test-tls-alpn-server-client.js
  202. +2 −2 test/parallel/test-tls-client-renegotiation-limit.js
  203. +1 −1 test/parallel/test-tls-connect-memleak.js
  204. +1 −1 test/parallel/test-tls-ecdh-auto.js
  205. +1 −1 test/parallel/test-tls-ecdh-multiple.js
  206. +1 −1 test/parallel/test-tls-ecdh.js
  207. +1 −1 test/parallel/test-tls-socket-close.js
  208. +6 −6 test/parallel/test-url-fileurltopath.js
  209. +1 −1 test/parallel/test-url-format.js
  210. +2 −2 test/parallel/test-url-parse-format.js
  211. +6 −6 test/parallel/test-url-pathtofileurl.js
  212. +13 −13 test/parallel/test-url-relative.js
  213. +1 −1 test/parallel/test-util-callbackify.js
  214. +2 −2 test/parallel/test-util-inspect.js
  215. +1 −1 test/parallel/test-util-isDeepStrictEqual.js
  216. +8 −8 test/parallel/test-v8-coverage.js
  217. +1 −1 test/parallel/test-vm-global-property-interceptors.js
  218. +1 −1 test/parallel/test-whatwg-url-custom-properties.js
  219. +1 −1 test/parallel/test-zlib-invalid-input.js
  220. +1 −1 test/parallel/test-zlib-random-byte-pipes.js
  221. +2 −2 test/parallel/test-zlib-truncated.js
  222. +3 −3 test/parallel/test-zlib.js
  223. +1 −1 test/pummel/test-fs-watch-file.js
  224. +1 −1 test/pummel/test-timers.js
  225. +1 −1 test/sequential/test-child-process-emfile.js
  226. +1 −1 test/sequential/test-cli-syntax-bad.js
  227. +1 −1 test/sequential/test-cli-syntax-file-not-found.js
  228. +2 −2 test/sequential/test-cli-syntax-require.js
  229. +1 −1 test/sequential/test-http-keepalive-maxsockets.js
  230. +1 −1 test/sequential/test-stream2-stderr-sync.js
  231. +1 −1 tools/eslint-rules/required-modules.js
  232. +1 −1 tools/test-npm-package.js
@@ -16,7 +16,7 @@ function CLI(usage, settings) {
if (!(this instanceof CLI)) return new CLI(usage, settings);

if (process.argv.length < 3) {
this.abort(usage); // abort will exit the process
this.abort(usage); // Abort will exit the process
}

this.usage = usage;
@@ -202,7 +202,7 @@ Benchmark.prototype.end = function(operations) {
if (elapsed[0] === 0 && elapsed[1] === 0) {
if (!process.env.NODEJS_BENCHMARK_ZERO_ALLOWED)
throw new Error('insufficient clock precision for short benchmark');
// avoid dividing by zero
// Avoid dividing by zero
elapsed[1] = 1;
}

@@ -1,4 +1,4 @@
// throughput benchmark
// Throughput benchmark
// creates a single hasher, then pushes a bunch of data through it
'use strict';
const common = require('../common.js');
@@ -1,4 +1,4 @@
// throughput benchmark
// Throughput benchmark
// creates a single hasher, then pushes a bunch of data through it
'use strict';
const common = require('../common.js');
@@ -9,7 +9,7 @@ const storedUnicode = Object.create(null);

const useDomains = process.env.NODE_USE_DOMAINS;

// set up one global domain.
// Set up one global domain.
if (useDomains) {
var domain = require('domain');
const gdom = domain.create();
@@ -5,7 +5,7 @@ const PORT = common.PORT;
const cluster = require('cluster');
if (cluster.isMaster) {
var bench = common.createBenchmark(main, {
// unicode confuses ab on os x.
// Unicode confuses ab on os x.
type: ['bytes', 'buffer'],
len: [4, 1024, 102400],
c: [50, 500]
@@ -3,7 +3,7 @@ const common = require('../common.js');
const http = require('http');

const bench = common.createBenchmark(main, {
// unicode confuses ab on os x.
// Unicode confuses ab on os x.
c: [50, 500],
n: [0, 5, 20]
});
@@ -2,7 +2,7 @@
const common = require('../common.js');

const bench = common.createBenchmark(main, {
// unicode confuses ab on os x.
// Unicode confuses ab on os x.
type: ['bytes', 'buffer'],
len: [4, 1024, 102400],
chunks: [1, 4],
@@ -33,7 +33,7 @@ function main({ dur, len, type }) {

const writer = new Writer();

// the actual benchmark.
// The actual benchmark.
const server = net.createServer((socket) => {
socket.pipe(writer);
});
@@ -34,7 +34,7 @@ function main({ dur, len, type }) {
const reader = new Reader();
const writer = new Writer();

// the actual benchmark.
// The actual benchmark.
const server = net.createServer((socket) => {
socket.pipe(writer);
});
@@ -34,7 +34,7 @@ function main({ dur, len, type }) {
const reader = new Reader();
const writer = new Writer();

// the actual benchmark.
// The actual benchmark.
const server = net.createServer((socket) => {
socket.pipe(socket);
});
@@ -33,7 +33,7 @@ function main({ dur, len, type }) {
const reader = new Reader();
const writer = new Writer();

// the actual benchmark.
// The actual benchmark.
const server = net.createServer((socket) => {
reader.pipe(socket);
});
@@ -38,7 +38,7 @@ function main({ dur, len, type }) {
const reader = new Reader();
const writer = new Writer();

// the actual benchmark.
// The actual benchmark.
const fakeSocket = new JSStreamWrap(new PassThrough());
bench.start();
reader.pipe(fakeSocket);
@@ -13,7 +13,7 @@ const bench = common.createBenchmark(main, {

function useLegacy(data) {
const len = data.length;
var result = url.parse(data[0]); // avoid dead code elimination
var result = url.parse(data[0]); // Avoid dead code elimination
bench.start();
for (var i = 0; i < len; ++i) {
result = url.parse(data[i]);
@@ -24,7 +24,7 @@ function useLegacy(data) {

function useWHATWGWithBase(data) {
const len = data.length;
var result = new URL(data[0][0], data[0][1]); // avoid dead code elimination
var result = new URL(data[0][0], data[0][1]); // Avoid dead code elimination
bench.start();
for (var i = 0; i < len; ++i) {
const item = data[i];
@@ -36,7 +36,7 @@ function useWHATWGWithBase(data) {

function useWHATWGWithoutBase(data) {
const len = data.length;
var result = new URL(data[0]); // avoid dead code elimination
var result = new URL(data[0]); // Avoid dead code elimination
bench.start();
for (var i = 0; i < len; ++i) {
result = new URL(data[i]);
@@ -3,7 +3,7 @@ const common = require('../common.js');
const URLSearchParams = require('url').URLSearchParams;

const inputs = {
wpt: 'wpt', // to work around tests
wpt: 'wpt', // To work around tests
empty: '',
sorted: 'a&b&c&d&e&f&g&h&i&j&k&l&m&n&o&p&q&r&s&t&u&v&w&x&y&z',
almostsorted: 'a&b&c&d&e&f&g&i&h&j&k&l&m&n&o&p&q&r&s&t&u&w&v&x&y&z',
@@ -315,7 +315,7 @@ if (cluster.isMaster) {
} else if (cluster.isWorker) {
const net = require('net');
const server = net.createServer((socket) => {
// connections never end
// Connections never end
});
server.listen(8000);
@@ -114,12 +114,12 @@ error output. If `stderr` is not provided, `stdout` is used for `stderr`.
```js
const output = fs.createWriteStream('./stdout.log');
const errorOutput = fs.createWriteStream('./stderr.log');
// custom simple logger
// Custom simple logger
const logger = new Console({ stdout: output, stderr: errorOutput });
// use it like console
const count = 5;
logger.log('count: %d', count);
// in stdout.log: count 5
// In stdout.log: count 5
```

The global `console` is a special `Console` whose output is sent to
@@ -135,7 +135,7 @@ if (cluster.isMaster) {
// But don't keep the process open just for that!
killtimer.unref();
// stop taking new requests.
// Stop taking new requests.
server.close();
// Let the master know we're dead. This will trigger a
@@ -316,14 +316,13 @@ const d = domain.create();
function readSomeFile(filename, cb) {
fs.readFile(filename, 'utf8', d.bind((er, data) => {
// If this throws, it will also be passed to the domain
// If this throws, it will also be passed to the domain.
return cb(er, data ? JSON.parse(data) : null);
}));
}
d.on('error', (er) => {
// an error occurred somewhere.
// if we throw it now, it will crash the program
// An error occurred somewhere. If we throw it now, it will crash the program
// with the normal line number and stack message.
});
```
@@ -377,7 +376,7 @@ function readSomeFile(filename, cb) {
// callback since it is assumed to be the 'Error' argument
// and thus intercepted by the domain.
// if this throws, it will also be passed to the domain
// If this throws, it will also be passed to the domain
// so the error-handling logic can be moved to the 'error'
// event on the domain instead of being repeated throughout
// the program.
@@ -386,8 +385,7 @@ function readSomeFile(filename, cb) {
}
d.on('error', (er) => {
// an error occurred somewhere.
// if we throw it now, it will crash the program
// An error occurred somewhere. If we throw it now, it will crash the program
// with the normal line number and stack message.
});
```
@@ -407,7 +407,7 @@ program.
try {
require('vm').runInThisContext('binary ! isNotOk');
} catch (err) {
// err will be a SyntaxError
// 'err' will be a SyntaxError.
}
```

@@ -422,7 +422,7 @@ string would be considered a `TypeError`.

```js
require('url').parse(() => { });
// throws TypeError, since it expected a string
// Throws TypeError, since it expected a string.
```

Node.js will generate and throw `TypeError` instances *immediately* as a form
@@ -648,7 +648,7 @@ emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// logs "log persistently" twice
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
```
@@ -358,7 +358,7 @@ const proxy = http.createServer((req, res) => {
res.end('okay');
});
proxy.on('connect', (req, cltSocket, head) => {
// connect to an origin server
// Connect to an origin server
const srvUrl = url.parse(`http://${req.url}`);
const srvSocket = net.connect(srvUrl.port, srvUrl.hostname, () => {
cltSocket.write('HTTP/1.1 200 Connection Established\r\n' +
@@ -370,7 +370,7 @@ proxy.on('connect', (req, cltSocket, head) => {
});
});
// now that proxy is running
// Now that proxy is running
proxy.listen(1337, '127.0.0.1', () => {
// Make a request to a tunneling proxy
@@ -504,7 +504,7 @@ srv.on('upgrade', (req, socket, head) => {
socket.pipe(socket); // echo back
});
// now that server is running
// Now that server is running
srv.listen(1337, '127.0.0.1', () => {
// make a request
@@ -626,11 +626,11 @@ request.setHeader('content-type', 'text/html');
request.setHeader('Content-Length', Buffer.byteLength(body));
request.setHeader('Cookie', ['type=ninja', 'language=javascript']);
const contentType = request.getHeader('Content-Type');
// contentType is 'text/html'
// 'contentType' is 'text/html'
const contentLength = request.getHeader('Content-Length');
// contentLength is of type number
// 'contentLength' is of type number
const cookie = request.getHeader('Cookie');
// cookie is of type string[]
// 'cookie' is of type string[]
```

### request.maxHeadersCount
@@ -745,7 +745,7 @@ req.once('response', (res) => {
const ip = req.socket.localAddress;
const port = req.socket.localPort;
console.log(`Your IP address is ${ip} and your source port is ${port}.`);
// consume response object
// Consume response object
});
```

@@ -2065,7 +2065,7 @@ req.on('error', (e) => {
console.error(`problem with request: ${e.message}`);
});
// write data to request body
// Write data to request body
req.write(postData);
req.end();
```
@@ -2437,7 +2437,7 @@ const client = http2.connect('http://localhost');
client.on('stream', (pushedStream, requestHeaders) => {
pushedStream.on('push', (responseHeaders) => {
// process response headers
// Process response headers
});
pushedStream.on('data', (chunk) => { /* handle pushed data */ });
});
@@ -295,8 +295,8 @@ process.on('unhandledRejection', (reason, p) => {
});
somePromise.then((res) => {
return reportToUser(JSON.pasre(res)); // note the typo (`pasre`)
}); // no `.catch()` or `.then()`
return reportToUser(JSON.pasre(res)); // Note the typo (`pasre`)
}); // No `.catch()` or `.then()`
```

The following will also trigger the `'unhandledRejection'` event to be
@@ -126,7 +126,7 @@ querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' });
// Returns 'foo=bar&baz=qux&baz=quux&corge='
querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':');
// returns 'foo:bar;baz:qux'
// Returns 'foo:bar;baz:qux'
```

By default, characters requiring percent-encoding within the query string will
@@ -683,7 +683,7 @@ pass.unpipe(writable);
// readableFlowing is now false
pass.on('data', (chunk) => { console.log(chunk.toString()); });
pass.write('ok'); // will not emit 'data'
pass.write('ok'); // Will not emit 'data'
pass.resume(); // Must be called to make stream emit 'data'
```

@@ -1206,7 +1206,7 @@ function parseHeader(stream, callback) {
while (null !== (chunk = stream.read())) {
const str = decoder.write(chunk);
if (str.match(/\n\n/)) {
// found the header boundary
// Found the header boundary
const split = str.split(/\n\n/);
header += split.shift();
const remaining = split.join('\n\n');
@@ -1219,7 +1219,7 @@ function parseHeader(stream, callback) {
// Now the body of the message can be read from the stream.
callback(null, header, stream);
} else {
// still reading the header.
// Still reading the header.
header += str;
}
}
@@ -163,7 +163,7 @@ setImmediatePromise('foobar').then((value) => {
// This is executed after all I/O callbacks.
});
// or with async function
// Or with async function
async function timerExample() {
console.log('Before I/O callbacks');
await setImmediatePromise();
@@ -758,7 +758,7 @@ option properties directly is also supported.
const util = require('util');
const arr = Array(101).fill(0);
console.log(arr); // logs the truncated array
console.log(arr); // Logs the truncated array
util.inspect.defaultOptions.maxArrayLength = null;
console.log(arr); // logs the full array
```
@@ -69,7 +69,7 @@ See [Memory Usage Tuning][] for more information on the speed/memory/compression
tradeoffs involved in `zlib` usage.

```js
// client request example
// Client request example
const zlib = require('zlib');
const http = require('http');
const fs = require('fs');

0 comments on commit b08a867

Please sign in to comment.
You can’t perform that action at this time.