Skip to content

Commit

Permalink
doc: add node: prefix for examples
Browse files Browse the repository at this point in the history
Core modules are currently distinguished with the `node:` prefix.
This updates a few examples in docs to use the prefix for consistency.

Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com>
PR-URL: #45328
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
  • Loading branch information
daeyeon authored and danielleadams committed Jan 3, 2023
1 parent c9c958e commit 3f69d21
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions doc/api/diagnostics_channel.md
Expand Up @@ -164,15 +164,15 @@ will be run synchronously whenever a message is published to the channel. Any
errors thrown in the message handler will trigger an [`'uncaughtException'`][].

```mjs
import diagnostics_channel from 'diagnostics_channel';
import diagnostics_channel from 'node:diagnostics_channel';

diagnostics_channel.subscribe('my-channel', (message, name) => {
// Received data
});
```

```cjs
const diagnostics_channel = require('diagnostics_channel');
const diagnostics_channel = require('node:diagnostics_channel');

diagnostics_channel.subscribe('my-channel', (message, name) => {
// Received data
Expand All @@ -194,7 +194,7 @@ Remove a message handler previously registered to this channel with
[`diagnostics_channel.subscribe(name, onMessage)`][].

```mjs
import diagnostics_channel from 'diagnostics_channel';
import diagnostics_channel from 'node:diagnostics_channel';

function onMessage(message, name) {
// Received data
Expand All @@ -206,7 +206,7 @@ diagnostics_channel.unsubscribe('my-channel', onMessage);
```

```cjs
const diagnostics_channel = require('diagnostics_channel');
const diagnostics_channel = require('node:diagnostics_channel');

function onMessage(message, name) {
// Received data
Expand Down
10 changes: 5 additions & 5 deletions doc/api/v8.md
Expand Up @@ -919,17 +919,17 @@ contains the following script:
```cjs
'use strict';

const fs = require('fs');
const zlib = require('zlib');
const path = require('path');
const assert = require('assert');
const fs = require('node:fs');
const zlib = require('node:zlib');
const path = require('node:path');
const assert = require('node:assert');

const {
isBuildingSnapshot,
addSerializeCallback,
addDeserializeCallback,
setDeserializeMainFunction
} = require('v8').startupSnapshot;
} = require('node:v8').startupSnapshot;

const filePath = path.resolve(__dirname, '../x1024.txt');
const storage = {};
Expand Down
4 changes: 2 additions & 2 deletions doc/api/webstreams.md
Expand Up @@ -1476,8 +1476,8 @@ console.log(`from readable: ${data.byteLength}`);
```cjs
const { arrayBuffer } = require('node:stream/consumers');
const { Readable } = require('stream');
const { TextEncoder } = require('util');
const { Readable } = require('node:stream');
const { TextEncoder } = require('node:util');

const encoder = new TextEncoder();
const dataArray = encoder.encode(['hello world from consumers!']);
Expand Down

0 comments on commit 3f69d21

Please sign in to comment.