| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f711a48 commit d093820
19 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,7 +61,7 @@ Errors that occur within _Asynchronous APIs_ may be reported in multiple ways: | |||
| 61 | 61 | <!-- eslint-disable no-useless-return --> | |
| 62 | 62 | ||
| 63 | 63 | ```js | |
| 64 | - const fs = require('fs/promises'); | ||
| 64 | + const fs = require('node:fs/promises'); | ||
| 65 | 65 | ||
| 66 | 66 | (async () => { | |
| 67 | 67 | let data; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -509,7 +509,7 @@ module default import or its corresponding sugar syntax: | |||
| 509 | 509 | ||
| 510 | 510 | ```js | |
| 511 | 511 | import { default as cjs } from 'cjs'; | |
| 512 | - // identical to the above | ||
| 512 | + // Identical to the above | ||
| 513 | 513 | import cjsSugar from 'cjs'; | |
| 514 | 514 | ||
| 515 | 515 | console.log(cjs); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -505,7 +505,7 @@ inspector.Network.requestWillBeSent({ | |||
| 505 | 505 | request: { | |
| 506 | 506 | url: 'https://nodejs.org/en', | |
| 507 | 507 | method: 'GET', | |
| 508 | - } | ||
| 508 | + }, | ||
| 509 | 509 | }); | |
| 510 | 510 | ``` | |
| 511 | 511 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -890,7 +890,7 @@ built-in modules and if a name matching a built-in module is added to the cache, | |||
| 890 | 890 | only `node:`-prefixed require calls are going to receive the built-in module. | |
| 891 | 891 | Use with care! | |
| 892 | 892 | ||
| 893 | - <!-- eslint-disable node-core/no-duplicate-requires --> | ||
| 893 | + <!-- eslint-disable node-core/no-duplicate-requires, no-restricted-syntax --> | ||
| 894 | 894 | ||
| 895 | 895 | ```js | |
| 896 | 896 | const assert = require('node:assert'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,7 +28,7 @@ performance.measure('Start to Now'); | |||
| 28 | 28 | ||
| 29 | 29 | performance.mark('A'); | |
| 30 | 30 | (async function doSomeLongRunningProcess() { | |
| 31 | - await new Promise(r => setTimeout(r, 5000)); | ||
| 31 | + await new Promise((r) => setTimeout(r, 5000)); | ||
| 32 | 32 | performance.measure('A to Now', 'A'); | |
| 33 | 33 | ||
| 34 | 34 | performance.mark('B'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2107,10 +2107,10 @@ class Test { | |||
| 2107 | 2107 | constructor() { | |
| 2108 | 2108 | finalization.register(this, (ref) => ref.dispose()); | |
| 2109 | 2109 | ||
| 2110 | - // even something like this is highly discouraged | ||
| 2110 | + // Even something like this is highly discouraged | ||
| 2111 | 2111 | // finalization.register(this, () => this.dispose()); | |
| 2112 | - } | ||
| 2113 | - dispose() {} | ||
| 2112 | + } | ||
| 2113 | + dispose() {} | ||
| 2114 | 2114 | } | |
| 2115 | 2115 | ``` | |
| 2116 | 2116 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,7 @@ The `punycode` module is a bundled version of the [Punycode.js][] module. It | |||
| 21 | 21 | can be accessed using: | |
| 22 | 22 | ||
| 23 | 23 | ```js | |
| 24 | - const punycode = require('punycode'); | ||
| 24 | + const punycode = require('node:punycode'); | ||
| 25 | 25 | ``` | |
| 26 | 26 | ||
| 27 | 27 | [Punycode][] is a character encoding scheme defined by RFC 3492 that is | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -315,7 +315,7 @@ events (due to incorrect stream implementations) do not cause unexpected | |||
| 315 | 315 | crashes. If this is unwanted behavior then `options.cleanup` should be set to | |
| 316 | 316 | `true`: | |
| 317 | 317 | ||
| 318 | - ```js | ||
| 318 | + ```mjs | ||
| 319 | 319 | await finished(rs, { cleanup: true }); | |
| 320 | 320 | ``` | |
| 321 | 321 | ||
@@ -3926,7 +3926,7 @@ const { StringDecoder } = require('node:string_decoder'); | |||
| 3926 | 3926 | class StringWritable extends Writable { | |
| 3927 | 3927 | constructor(options) { | |
| 3928 | 3928 | super(options); | |
| 3929 | - this._decoder = new StringDecoder(options && options.defaultEncoding); | ||
| 3929 | + this._decoder = new StringDecoder(options?.defaultEncoding); | ||
| 3930 | 3930 | this.data = ''; | |
| 3931 | 3931 | } | |
| 3932 | 3932 | _write(chunk, encoding, callback) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3281,7 +3281,7 @@ test('snapshot test with default serialization', (t) => { | |||
| 3281 | 3281 | ||
| 3282 | 3282 | test('snapshot test with custom serialization', (t) => { | |
| 3283 | 3283 | t.assert.snapshot({ value3: 3, value4: 4 }, { | |
| 3284 | - serializers: [(value) => JSON.stringify(value)] | ||
| 3284 | + serializers: [(value) => JSON.stringify(value)], | ||
| 3285 | 3285 | }); | |
| 3286 | 3286 | }); | |
| 3287 | 3287 | ``` | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -465,13 +465,13 @@ to set the security level to 0 while using the default OpenSSL cipher list, you | |||
| 465 | 465 | const tls = require('node:tls'); | |
| 466 | 466 | const port = 443; | |
| 467 | 467 | ||
| 468 | - tls.createServer({ciphers: 'DEFAULT@SECLEVEL=0', minVersion: 'TLSv1'}, function (socket) { | ||
| 468 | + tls.createServer({ ciphers: 'DEFAULT@SECLEVEL=0', minVersion: 'TLSv1' }, function(socket) { | ||
| 469 | 469 | console.log('Client connected with protocol:', socket.getProtocol()); | |
| 470 | 470 | socket.end(); | |
| 471 | 471 | this.close(); | |
| 472 | - }). | ||
| 473 | - listen(port, () => { | ||
| 474 | - tls.connect(port, {ciphers: 'DEFAULT@SECLEVEL=0', maxVersion: 'TLSv1'}); | ||
| 472 | + }) | ||
| 473 | + .listen(port, () => { | ||
| 474 | + tls.connect(port, { ciphers: 'DEFAULT@SECLEVEL=0', maxVersion: 'TLSv1' }); | ||
| 475 | 475 | }); | |
| 476 | 476 | ``` | |
| 477 | 477 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments