| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 352daac commit 312bb4d
17 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 | |
|---|---|---|---|
@@ -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 | |
|---|---|---|---|
@@ -889,7 +889,7 @@ built-in modules and if a name matching a built-in module is added to the cache, | |||
| 889 | 889 | only `node:`-prefixed require calls are going to receive the built-in module. | |
| 890 | 890 | Use with care! | |
| 891 | 891 | ||
| 892 | - <!-- eslint-disable node-core/no-duplicate-requires --> | ||
| 892 | + <!-- eslint-disable node-core/no-duplicate-requires, no-restricted-syntax --> | ||
| 893 | 893 | ||
| 894 | 894 | ```js | |
| 895 | 895 | 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 | |
|---|---|---|---|
@@ -2099,10 +2099,10 @@ class Test { | |||
| 2099 | 2099 | constructor() { | |
| 2100 | 2100 | finalization.register(this, (ref) => ref.dispose()); | |
| 2101 | 2101 | ||
| 2102 | - // even something like this is highly discouraged | ||
| 2102 | + // Even something like this is highly discouraged | ||
| 2103 | 2103 | // finalization.register(this, () => this.dispose()); | |
| 2104 | - } | ||
| 2105 | - dispose() {} | ||
| 2104 | + } | ||
| 2105 | + dispose() {} | ||
| 2106 | 2106 | } | |
| 2107 | 2107 | ``` | |
| 2108 | 2108 | ||
| 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 | ||
@@ -3916,7 +3916,7 @@ const { StringDecoder } = require('node:string_decoder'); | |||
| 3916 | 3916 | class StringWritable extends Writable { | |
| 3917 | 3917 | constructor(options) { | |
| 3918 | 3918 | super(options); | |
| 3919 | - this._decoder = new StringDecoder(options && options.defaultEncoding); | ||
| 3919 | + this._decoder = new StringDecoder(options?.defaultEncoding); | ||
| 3920 | 3920 | this.data = ''; | |
| 3921 | 3921 | } | |
| 3922 | 3922 | _write(chunk, encoding, callback) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3256,7 +3256,7 @@ test('snapshot test with default serialization', (t) => { | |||
| 3256 | 3256 | ||
| 3257 | 3257 | test('snapshot test with custom serialization', (t) => { | |
| 3258 | 3258 | t.assert.snapshot({ value3: 3, value4: 4 }, { | |
| 3259 | - serializers: [(value) => JSON.stringify(value)] | ||
| 3259 | + serializers: [(value) => JSON.stringify(value)], | ||
| 3260 | 3260 | }); | |
| 3261 | 3261 | }); | |
| 3262 | 3262 | ``` | |
| 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 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -245,7 +245,7 @@ console.log(trace_events.getEnabledCategories()); | |||
| 245 | 245 | ```js | |
| 246 | 246 | 'use strict'; | |
| 247 | 247 | ||
| 248 | - const { Session } = require('inspector'); | ||
| 248 | + const { Session } = require('node:inspector'); | ||
| 249 | 249 | const session = new Session(); | |
| 250 | 250 | session.connect(); | |
| 251 | 251 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments