@types/node 24.12.0 → 25.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node v24.12/README.md → node/README.md +2 -2
- node v24.12/assert/strict.d.ts → node/assert/strict.d.ts +5 -11
- node v24.12/assert.d.ts → node/assert.d.ts +11 -171
- node v24.12/async_hooks.d.ts → node/async_hooks.d.ts +8 -8
- node v24.12/buffer.buffer.d.ts → node/buffer.buffer.d.ts +1 -7
- node v24.12/buffer.d.ts → node/buffer.d.ts +44 -168
- node v24.12/child_process.d.ts → node/child_process.d.ts +21 -64
- node/cluster.d.ts +486 -0
- node/console.d.ts +151 -0
- node v24.12/constants.d.ts → node/constants.d.ts +3 -4
- node v24.12/crypto.d.ts → node/crypto.d.ts +287 -1639
- node v24.12/dgram.d.ts → node/dgram.d.ts +15 -51
- node v24.12/diagnostics_channel.d.ts → node/diagnostics_channel.d.ts +4 -4
- node v24.12/dns/promises.d.ts → node/dns/promises.d.ts +3 -3
- node v24.12/dns.d.ts → node/dns.d.ts +131 -132
- node v24.12/domain.d.ts → node/domain.d.ts +13 -17
- node v24.12/events.d.ts → node/events.d.ts +866 -795
- node v24.12/fs/promises.d.ts → node/fs/promises.d.ts +7 -8
- node v24.12/fs.d.ts → node/fs.d.ts +419 -455
- node v24.12/globals.d.ts → node/globals.d.ts +6 -26
- node/globals.typedarray.d.ts +101 -0
- node v24.12/http.d.ts → node/http.d.ts +310 -276
- node v24.12/http2.d.ts → node/http2.d.ts +528 -804
- node v24.12/https.d.ts → node/https.d.ts +63 -243
- node v24.12/index.d.ts → node/index.d.ts +15 -1
- node/inspector/promises.d.ts +41 -0
- node v24.12/inspector.d.ts → node/inspector.d.ts +42 -50
- node v24.12/inspector.generated.d.ts → node/inspector.generated.d.ts +572 -417
- node v24.12/module.d.ts → node/module.d.ts +47 -195
- node v24.12/net.d.ts → node/net.d.ts +68 -189
- node v24.12/os.d.ts → node/os.d.ts +6 -6
- node v24.12/package.json → node/package.json +3 -3
- node/path/posix.d.ts +8 -0
- node/path/win32.d.ts +8 -0
- node/path.d.ts +187 -0
- node/perf_hooks.d.ts +643 -0
- node v24.12/process.d.ts → node/process.d.ts +219 -127
- node v24.12/punycode.d.ts → node/punycode.d.ts +5 -5
- node v24.12/querystring.d.ts → node/querystring.d.ts +4 -4
- node/quic.d.ts +910 -0
- node v24.12/readline/promises.d.ts → node/readline/promises.d.ts +3 -3
- node v24.12/readline.d.ts → node/readline.d.ts +68 -120
- node v24.12/repl.d.ts → node/repl.d.ts +75 -98
- node v24.12/sea.d.ts → node/sea.d.ts +1 -1
- node v24.12/sqlite.d.ts → node/sqlite.d.ts +137 -30
- node v24.12/stream/consumers.d.ts → node/stream/consumers.d.ts +10 -10
- node/stream/promises.d.ts +211 -0
- node/stream/web.d.ts +296 -0
- node v24.12/stream.d.ts → node/stream.d.ts +565 -478
- node v24.12/string_decoder.d.ts → node/string_decoder.d.ts +4 -4
- node/test/reporters.d.ts +96 -0
- node v24.12/test.d.ts → node/test.d.ts +134 -199
- node v24.12/timers/promises.d.ts → node/timers/promises.d.ts +4 -4
- node v24.12/timers.d.ts → node/timers.d.ts +4 -130
- node v24.12/tls.d.ts → node/tls.d.ts +109 -179
- node v24.12/trace_events.d.ts → node/trace_events.d.ts +9 -9
- node v24.12/ts5.6/buffer.buffer.d.ts → node/ts5.6/buffer.buffer.d.ts +1 -7
- node v24.12/ts5.6/index.d.ts → node/ts5.6/index.d.ts +15 -1
- node v24.12/ts5.7/index.d.ts → node/ts5.7/index.d.ts +15 -1
- node v24.12/tty.d.ts → node/tty.d.ts +58 -16
- node/url.d.ts +541 -0
- node/util/types.d.ts +558 -0
- node v24.12/util.d.ts → node/util.d.ts +150 -796
- node v24.12/v8.d.ts → node/v8.d.ts +31 -21
- node v24.12/vm.d.ts → node/vm.d.ts +43 -30
- node v24.12/wasi.d.ts → node/wasi.d.ts +4 -4
- node v24.12/web-globals/abortcontroller.d.ts → node/web-globals/abortcontroller.d.ts +27 -2
- node/web-globals/blob.d.ts +23 -0
- node/web-globals/console.d.ts +9 -0
- node v24.12/web-globals/crypto.d.ts → node/web-globals/crypto.d.ts +7 -0
- node/web-globals/encoding.d.ts +11 -0
- node v24.12/web-globals/events.d.ts → node/web-globals/events.d.ts +9 -0
- node v24.12/web-globals/fetch.d.ts → node/web-globals/fetch.d.ts +7 -0
- node/web-globals/importmeta.d.ts +13 -0
- node/web-globals/messaging.d.ts +23 -0
- node/web-globals/performance.d.ts +45 -0
- node/web-globals/streams.d.ts +115 -0
- node/web-globals/timers.d.ts +44 -0
- node/web-globals/url.d.ts +24 -0
- node v24.12/worker_threads.d.ts → node/worker_threads.d.ts +186 -363
- node v24.12/zlib.d.ts → node/zlib.d.ts +8 -71
- node v24.12/cluster.d.ts +0 -578
- node v24.12/console.d.ts +0 -453
- node v24.12/globals.typedarray.d.ts +0 -41
- node v24.12/path.d.ts +0 -200
- node v24.12/perf_hooks.d.ts +0 -1042
- node v24.12/stream/promises.d.ts +0 -90
- node v24.12/stream/web.d.ts +0 -573
- node v24.12/url.d.ts +0 -1057
- node v24.12/web-globals/streams.d.ts +0 -22
- {node v24.12 → node}/LICENSE +0 -0
- {node v24.12 → node}/compatibility/iterators.d.ts +0 -0
- {node v24.12 → node}/ts5.6/compatibility/float16array.d.ts +0 -0
- {node v24.12 → node}/ts5.6/globals.typedarray.d.ts +0 -0
- {node v24.12 → node}/ts5.7/compatibility/float16array.d.ts +0 -0
- {node v24.12 → node}/web-globals/domexception.d.ts +0 -0
- {node v24.12 → node}/web-globals/navigator.d.ts +0 -0
- {node v24.12 → node}/web-globals/storage.d.ts +0 -0
|
@@ -6,10 +6,60 @@
|
|
|
6
6
|
* ```js
|
|
7
7
|
* import util from 'node:util';
|
|
8
8
|
* ```
|
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/util.js)
|
|
10
10
|
*/
|
|
11
|
-
declare module "util" {
|
|
12
|
-
|
|
11
|
+
declare module "node:util" {
|
|
12
|
+
export * as types from "node:util/types";
|
|
13
|
+
export type InspectStyle =
|
|
14
|
+
| "special"
|
|
15
|
+
| "number"
|
|
16
|
+
| "bigint"
|
|
17
|
+
| "boolean"
|
|
18
|
+
| "undefined"
|
|
19
|
+
| "null"
|
|
20
|
+
| "string"
|
|
21
|
+
| "symbol"
|
|
22
|
+
| "date"
|
|
23
|
+
| "name"
|
|
24
|
+
| "regexp"
|
|
25
|
+
| "module";
|
|
26
|
+
export interface InspectStyles extends Record<InspectStyle, InspectColor | ((value: string) => string)> {
|
|
27
|
+
regexp: {
|
|
28
|
+
(value: string): string;
|
|
29
|
+
colors: InspectColor[];
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export type InspectColorModifier =
|
|
33
|
+
| "reset"
|
|
34
|
+
| "bold"
|
|
35
|
+
| "dim"
|
|
36
|
+
| "italic"
|
|
37
|
+
| "underline"
|
|
38
|
+
| "blink"
|
|
39
|
+
| "inverse"
|
|
40
|
+
| "hidden"
|
|
41
|
+
| "strikethrough"
|
|
42
|
+
| "doubleunderline";
|
|
43
|
+
export type InspectColorForeground =
|
|
44
|
+
| "black"
|
|
45
|
+
| "red"
|
|
46
|
+
| "green"
|
|
47
|
+
| "yellow"
|
|
48
|
+
| "blue"
|
|
49
|
+
| "magenta"
|
|
50
|
+
| "cyan"
|
|
51
|
+
| "white"
|
|
52
|
+
| "gray"
|
|
53
|
+
| "redBright"
|
|
54
|
+
| "greenBright"
|
|
55
|
+
| "yellowBright"
|
|
56
|
+
| "blueBright"
|
|
57
|
+
| "magentaBright"
|
|
58
|
+
| "cyanBright"
|
|
59
|
+
| "whiteBright";
|
|
60
|
+
export type InspectColorBackground = `bg${Capitalize<InspectColorForeground>}`;
|
|
61
|
+
export type InspectColor = InspectColorModifier | InspectColorForeground | InspectColorBackground;
|
|
62
|
+
export interface InspectColors extends Record<InspectColor, [number, number]> {}
|
|
13
63
|
export interface InspectOptions {
|
|
14
64
|
/**
|
|
15
65
|
* If `true`, object's non-enumerable symbols and properties are included in the formatted result.
|
|
@@ -92,22 +142,26 @@ declare module "util" {
|
|
|
92
142
|
*/
|
|
93
143
|
numericSeparator?: boolean | undefined;
|
|
94
144
|
}
|
|
95
|
-
export
|
|
96
|
-
|
|
97
|
-
| "number"
|
|
98
|
-
| "bigint"
|
|
99
|
-
| "boolean"
|
|
100
|
-
| "undefined"
|
|
101
|
-
| "null"
|
|
102
|
-
| "string"
|
|
103
|
-
| "symbol"
|
|
104
|
-
| "date"
|
|
105
|
-
| "regexp"
|
|
106
|
-
| "module";
|
|
107
|
-
export type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => any; // TODO: , inspect: inspect
|
|
108
|
-
export interface InspectOptionsStylized extends InspectOptions {
|
|
109
|
-
stylize(text: string, styleType: Style): string;
|
|
145
|
+
export interface InspectContext extends Required<InspectOptions> {
|
|
146
|
+
stylize(text: string, styleType: InspectStyle): string;
|
|
110
147
|
}
|
|
148
|
+
import _inspect = inspect;
|
|
149
|
+
export interface Inspectable {
|
|
150
|
+
[inspect.custom](depth: number, options: InspectContext, inspect: typeof _inspect): any;
|
|
151
|
+
}
|
|
152
|
+
// TODO: Remove these in a future major
|
|
153
|
+
/** @deprecated Use `InspectStyle` instead. */
|
|
154
|
+
export type Style = Exclude<InspectStyle, "name">;
|
|
155
|
+
/** @deprecated Use the `Inspectable` interface instead. */
|
|
156
|
+
export type CustomInspectFunction = (depth: number, options: InspectContext) => any;
|
|
157
|
+
/** @deprecated Use `InspectContext` instead. */
|
|
158
|
+
export interface InspectOptionsStylized extends InspectContext {}
|
|
159
|
+
/** @deprecated Use `InspectColorModifier` instead. */
|
|
160
|
+
export type Modifiers = InspectColorModifier;
|
|
161
|
+
/** @deprecated Use `InspectColorForeground` instead. */
|
|
162
|
+
export type ForegroundColors = InspectColorForeground;
|
|
163
|
+
/** @deprecated Use `InspectColorBackground` instead. */
|
|
164
|
+
export type BackgroundColors = InspectColorBackground;
|
|
111
165
|
export interface CallSiteObject {
|
|
112
166
|
/**
|
|
113
167
|
* Returns the name of the function associated with this call site.
|
|
@@ -243,7 +297,7 @@ declare module "util" {
|
|
|
243
297
|
* @since v10.0.0
|
|
244
298
|
*/
|
|
245
299
|
export function formatWithOptions(inspectOptions: InspectOptions, format?: any, ...param: any[]): string;
|
|
246
|
-
interface GetCallSitesOptions {
|
|
300
|
+
export interface GetCallSitesOptions {
|
|
247
301
|
/**
|
|
248
302
|
* Reconstruct the original location in the stacktrace from the source-map.
|
|
249
303
|
* Enabled by default with the flag `--enable-source-maps`.
|
|
@@ -254,6 +308,9 @@ declare module "util" {
|
|
|
254
308
|
* Returns an array of call site objects containing the stack of
|
|
255
309
|
* the caller function.
|
|
256
310
|
*
|
|
311
|
+
* Unlike accessing an `error.stack`, the result returned from this API is not
|
|
312
|
+
* interfered with `Error.prepareStackTrace`.
|
|
313
|
+
*
|
|
257
314
|
* ```js
|
|
258
315
|
* import { getCallSites } from 'node:util';
|
|
259
316
|
*
|
|
@@ -266,7 +323,7 @@ declare module "util" {
|
|
|
266
323
|
* console.log(`Function Name: ${callSite.functionName}`);
|
|
267
324
|
* console.log(`Script Name: ${callSite.scriptName}`);
|
|
268
325
|
* console.log(`Line Number: ${callSite.lineNumber}`);
|
|
269
|
-
* console.log(`Column Number: ${callSite.
|
|
326
|
+
* console.log(`Column Number: ${callSite.columnNumber}`);
|
|
270
327
|
* });
|
|
271
328
|
* // CallSite 1:
|
|
272
329
|
* // Function Name: exampleFunction
|
|
@@ -609,19 +666,11 @@ declare module "util" {
|
|
|
609
666
|
export function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
|
|
610
667
|
export function inspect(object: any, options?: InspectOptions): string;
|
|
611
668
|
export namespace inspect {
|
|
612
|
-
|
|
613
|
-
let
|
|
614
|
-
|
|
615
|
-
};
|
|
669
|
+
const custom: unique symbol;
|
|
670
|
+
let colors: InspectColors;
|
|
671
|
+
let styles: InspectStyles;
|
|
616
672
|
let defaultOptions: InspectOptions;
|
|
617
|
-
/**
|
|
618
|
-
* Allows changing inspect settings from the repl.
|
|
619
|
-
*/
|
|
620
673
|
let replDefaults: InspectOptions;
|
|
621
|
-
/**
|
|
622
|
-
* That can be used to declare custom inspect functions.
|
|
623
|
-
*/
|
|
624
|
-
const custom: unique symbol;
|
|
625
674
|
}
|
|
626
675
|
/**
|
|
627
676
|
* Alias for [`Array.isArray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray).
|
|
@@ -704,6 +753,28 @@ declare module "util" {
|
|
|
704
753
|
* @legacy Use ES2015 class syntax and `extends` keyword instead.
|
|
705
754
|
*/
|
|
706
755
|
export function inherits(constructor: unknown, superConstructor: unknown): void;
|
|
756
|
+
/**
|
|
757
|
+
* The `util.convertProcessSignalToExitCode()` method converts a signal name to its
|
|
758
|
+
* corresponding POSIX exit code. Following the POSIX standard, the exit code
|
|
759
|
+
* for a process terminated by a signal is calculated as `128 + signal number`.
|
|
760
|
+
*
|
|
761
|
+
* If `signal` is not a valid signal name, then an error will be thrown. See
|
|
762
|
+
* [`signal(7)`](https://man7.org/linux/man-pages/man7/signal.7.html) for a list of valid signals.
|
|
763
|
+
*
|
|
764
|
+
* ```js
|
|
765
|
+
* import { convertProcessSignalToExitCode } from 'node:util';
|
|
766
|
+
*
|
|
767
|
+
* console.log(convertProcessSignalToExitCode('SIGTERM')); // 143 (128 + 15)
|
|
768
|
+
* console.log(convertProcessSignalToExitCode('SIGKILL')); // 137 (128 + 9)
|
|
769
|
+
* ```
|
|
770
|
+
*
|
|
771
|
+
* This is particularly useful when working with processes to determine
|
|
772
|
+
* the exit code based on the signal that terminated the process.
|
|
773
|
+
* @since v25.4.0
|
|
774
|
+
* @param signal A signal name (e.g. `'SIGTERM'`)
|
|
775
|
+
* @returns The exit code corresponding to `signal`
|
|
776
|
+
*/
|
|
777
|
+
export function convertProcessSignalToExitCode(signal: NodeJS.Signals): number;
|
|
707
778
|
export type DebugLoggerFunction = (msg: string, ...param: unknown[]) => void;
|
|
708
779
|
export interface DebugLogger extends DebugLoggerFunction {
|
|
709
780
|
/**
|
|
@@ -758,7 +829,7 @@ declare module "util" {
|
|
|
758
829
|
*
|
|
759
830
|
* ```js
|
|
760
831
|
* import { debuglog } from 'node:util';
|
|
761
|
-
* const log = debuglog('foo');
|
|
832
|
+
* const log = debuglog('foo-bar');
|
|
762
833
|
*
|
|
763
834
|
* log('hi there, it\'s foo-bar [%d]', 2333);
|
|
764
835
|
* ```
|
|
@@ -794,8 +865,9 @@ declare module "util" {
|
|
|
794
865
|
export { debuglog as debug };
|
|
795
866
|
export interface DeprecateOptions {
|
|
796
867
|
/**
|
|
797
|
-
* When false do not change the prototype of object
|
|
798
|
-
*
|
|
868
|
+
* When false do not change the prototype of object
|
|
869
|
+
* while emitting the deprecation warning.
|
|
870
|
+
* @since v25.2.0
|
|
799
871
|
* @default true
|
|
800
872
|
*/
|
|
801
873
|
modifyPrototype?: boolean | undefined;
|
|
@@ -1053,7 +1125,7 @@ declare module "util" {
|
|
|
1053
1125
|
* ```
|
|
1054
1126
|
*
|
|
1055
1127
|
* If there is an `original[util.promisify.custom]` property present, `promisify`
|
|
1056
|
-
* will return its value, see [Custom promisified functions](https://nodejs.org/docs/latest-
|
|
1128
|
+
* will return its value, see [Custom promisified functions](https://nodejs.org/docs/latest-v25.x/api/util.html#custom-promisified-functions).
|
|
1057
1129
|
*
|
|
1058
1130
|
* `promisify()` assumes that `original` is a function taking a callback as its
|
|
1059
1131
|
* final argument in all cases. If `original` is not a function, `promisify()`
|
|
@@ -1144,61 +1216,6 @@ declare module "util" {
|
|
|
1144
1216
|
* @since v20.12.0
|
|
1145
1217
|
*/
|
|
1146
1218
|
export function parseEnv(content: string): NodeJS.Dict<string>;
|
|
1147
|
-
// https://nodejs.org/docs/latest/api/util.html#foreground-colors
|
|
1148
|
-
type ForegroundColors =
|
|
1149
|
-
| "black"
|
|
1150
|
-
| "blackBright"
|
|
1151
|
-
| "blue"
|
|
1152
|
-
| "blueBright"
|
|
1153
|
-
| "cyan"
|
|
1154
|
-
| "cyanBright"
|
|
1155
|
-
| "gray"
|
|
1156
|
-
| "green"
|
|
1157
|
-
| "greenBright"
|
|
1158
|
-
| "grey"
|
|
1159
|
-
| "magenta"
|
|
1160
|
-
| "magentaBright"
|
|
1161
|
-
| "red"
|
|
1162
|
-
| "redBright"
|
|
1163
|
-
| "white"
|
|
1164
|
-
| "whiteBright"
|
|
1165
|
-
| "yellow"
|
|
1166
|
-
| "yellowBright";
|
|
1167
|
-
// https://nodejs.org/docs/latest/api/util.html#background-colors
|
|
1168
|
-
type BackgroundColors =
|
|
1169
|
-
| "bgBlack"
|
|
1170
|
-
| "bgBlackBright"
|
|
1171
|
-
| "bgBlue"
|
|
1172
|
-
| "bgBlueBright"
|
|
1173
|
-
| "bgCyan"
|
|
1174
|
-
| "bgCyanBright"
|
|
1175
|
-
| "bgGray"
|
|
1176
|
-
| "bgGreen"
|
|
1177
|
-
| "bgGreenBright"
|
|
1178
|
-
| "bgGrey"
|
|
1179
|
-
| "bgMagenta"
|
|
1180
|
-
| "bgMagentaBright"
|
|
1181
|
-
| "bgRed"
|
|
1182
|
-
| "bgRedBright"
|
|
1183
|
-
| "bgWhite"
|
|
1184
|
-
| "bgWhiteBright"
|
|
1185
|
-
| "bgYellow"
|
|
1186
|
-
| "bgYellowBright";
|
|
1187
|
-
// https://nodejs.org/docs/latest/api/util.html#modifiers
|
|
1188
|
-
type Modifiers =
|
|
1189
|
-
| "blink"
|
|
1190
|
-
| "bold"
|
|
1191
|
-
| "dim"
|
|
1192
|
-
| "doubleunderline"
|
|
1193
|
-
| "framed"
|
|
1194
|
-
| "hidden"
|
|
1195
|
-
| "inverse"
|
|
1196
|
-
| "italic"
|
|
1197
|
-
| "none"
|
|
1198
|
-
| "overlined"
|
|
1199
|
-
| "reset"
|
|
1200
|
-
| "strikethrough"
|
|
1201
|
-
| "underline";
|
|
1202
1219
|
export interface StyleTextOptions {
|
|
1203
1220
|
/**
|
|
1204
1221
|
* When true, `stream` is checked to see if it can handle colors.
|
|
@@ -1253,142 +1270,19 @@ declare module "util" {
|
|
|
1253
1270
|
*
|
|
1254
1271
|
* The special format value `none` applies no additional styling to the text.
|
|
1255
1272
|
*
|
|
1256
|
-
* The full list of formats can be found in [modifiers](https://nodejs.org/docs/latest-
|
|
1273
|
+
* The full list of formats can be found in [modifiers](https://nodejs.org/docs/latest-v25.x/api/util.html#modifiers).
|
|
1257
1274
|
* @param format A text format or an Array of text formats defined in `util.inspect.colors`.
|
|
1258
1275
|
* @param text The text to to be formatted.
|
|
1259
1276
|
* @since v20.12.0
|
|
1260
1277
|
*/
|
|
1261
1278
|
export function styleText(
|
|
1262
|
-
format:
|
|
1263
|
-
| ForegroundColors
|
|
1264
|
-
| BackgroundColors
|
|
1265
|
-
| Modifiers
|
|
1266
|
-
| Array<ForegroundColors | BackgroundColors | Modifiers>,
|
|
1279
|
+
format: InspectColor | readonly InspectColor[],
|
|
1267
1280
|
text: string,
|
|
1268
1281
|
options?: StyleTextOptions,
|
|
1269
1282
|
): string;
|
|
1270
|
-
/**
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
* ```js
|
|
1274
|
-
* const decoder = new TextDecoder();
|
|
1275
|
-
* const u8arr = new Uint8Array([72, 101, 108, 108, 111]);
|
|
1276
|
-
* console.log(decoder.decode(u8arr)); // Hello
|
|
1277
|
-
* ```
|
|
1278
|
-
* @since v8.3.0
|
|
1279
|
-
*/
|
|
1280
|
-
export class TextDecoder {
|
|
1281
|
-
/**
|
|
1282
|
-
* The encoding supported by the `TextDecoder` instance.
|
|
1283
|
-
*/
|
|
1284
|
-
readonly encoding: string;
|
|
1285
|
-
/**
|
|
1286
|
-
* The value will be `true` if decoding errors result in a `TypeError` being
|
|
1287
|
-
* thrown.
|
|
1288
|
-
*/
|
|
1289
|
-
readonly fatal: boolean;
|
|
1290
|
-
/**
|
|
1291
|
-
* The value will be `true` if the decoding result will include the byte order
|
|
1292
|
-
* mark.
|
|
1293
|
-
*/
|
|
1294
|
-
readonly ignoreBOM: boolean;
|
|
1295
|
-
constructor(
|
|
1296
|
-
encoding?: string,
|
|
1297
|
-
options?: {
|
|
1298
|
-
fatal?: boolean | undefined;
|
|
1299
|
-
ignoreBOM?: boolean | undefined;
|
|
1300
|
-
},
|
|
1301
|
-
);
|
|
1302
|
-
/**
|
|
1303
|
-
* Decodes the `input` and returns a string. If `options.stream` is `true`, any
|
|
1304
|
-
* incomplete byte sequences occurring at the end of the `input` are buffered
|
|
1305
|
-
* internally and emitted after the next call to `textDecoder.decode()`.
|
|
1306
|
-
*
|
|
1307
|
-
* If `textDecoder.fatal` is `true`, decoding errors that occur will result in a `TypeError` being thrown.
|
|
1308
|
-
* @param input An `ArrayBuffer`, `DataView`, or `TypedArray` instance containing the encoded data.
|
|
1309
|
-
*/
|
|
1310
|
-
decode(
|
|
1311
|
-
input?: NodeJS.ArrayBufferView | ArrayBuffer | null,
|
|
1312
|
-
options?: {
|
|
1313
|
-
stream?: boolean | undefined;
|
|
1314
|
-
},
|
|
1315
|
-
): string;
|
|
1316
|
-
}
|
|
1317
|
-
export interface EncodeIntoResult {
|
|
1318
|
-
/**
|
|
1319
|
-
* The read Unicode code units of input.
|
|
1320
|
-
*/
|
|
1321
|
-
read: number;
|
|
1322
|
-
/**
|
|
1323
|
-
* The written UTF-8 bytes of output.
|
|
1324
|
-
*/
|
|
1325
|
-
written: number;
|
|
1326
|
-
}
|
|
1327
|
-
export { types };
|
|
1328
|
-
|
|
1329
|
-
//// TextEncoder/Decoder
|
|
1330
|
-
/**
|
|
1331
|
-
* An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextEncoder` API. All
|
|
1332
|
-
* instances of `TextEncoder` only support UTF-8 encoding.
|
|
1333
|
-
*
|
|
1334
|
-
* ```js
|
|
1335
|
-
* const encoder = new TextEncoder();
|
|
1336
|
-
* const uint8array = encoder.encode('this is some data');
|
|
1337
|
-
* ```
|
|
1338
|
-
*
|
|
1339
|
-
* The `TextEncoder` class is also available on the global object.
|
|
1340
|
-
* @since v8.3.0
|
|
1341
|
-
*/
|
|
1342
|
-
export class TextEncoder {
|
|
1343
|
-
/**
|
|
1344
|
-
* The encoding supported by the `TextEncoder` instance. Always set to `'utf-8'`.
|
|
1345
|
-
*/
|
|
1346
|
-
readonly encoding: string;
|
|
1347
|
-
/**
|
|
1348
|
-
* UTF-8 encodes the `input` string and returns a `Uint8Array` containing the
|
|
1349
|
-
* encoded bytes.
|
|
1350
|
-
* @param [input='an empty string'] The text to encode.
|
|
1351
|
-
*/
|
|
1352
|
-
encode(input?: string): NodeJS.NonSharedUint8Array;
|
|
1353
|
-
/**
|
|
1354
|
-
* UTF-8 encodes the `src` string to the `dest` Uint8Array and returns an object
|
|
1355
|
-
* containing the read Unicode code units and written UTF-8 bytes.
|
|
1356
|
-
*
|
|
1357
|
-
* ```js
|
|
1358
|
-
* const encoder = new TextEncoder();
|
|
1359
|
-
* const src = 'this is some data';
|
|
1360
|
-
* const dest = new Uint8Array(10);
|
|
1361
|
-
* const { read, written } = encoder.encodeInto(src, dest);
|
|
1362
|
-
* ```
|
|
1363
|
-
* @param src The text to encode.
|
|
1364
|
-
* @param dest The array to hold the encode result.
|
|
1365
|
-
*/
|
|
1366
|
-
encodeInto(src: string, dest: Uint8Array): EncodeIntoResult;
|
|
1367
|
-
}
|
|
1368
|
-
import { TextDecoder as _TextDecoder, TextEncoder as _TextEncoder } from "util";
|
|
1369
|
-
global {
|
|
1370
|
-
/**
|
|
1371
|
-
* `TextDecoder` class is a global reference for `import { TextDecoder } from 'node:util'`
|
|
1372
|
-
* https://nodejs.org/api/globals.html#textdecoder
|
|
1373
|
-
* @since v11.0.0
|
|
1374
|
-
*/
|
|
1375
|
-
var TextDecoder: typeof globalThis extends {
|
|
1376
|
-
onmessage: any;
|
|
1377
|
-
TextDecoder: infer TextDecoder;
|
|
1378
|
-
} ? TextDecoder
|
|
1379
|
-
: typeof _TextDecoder;
|
|
1380
|
-
/**
|
|
1381
|
-
* `TextEncoder` class is a global reference for `import { TextEncoder } from 'node:util'`
|
|
1382
|
-
* https://nodejs.org/api/globals.html#textencoder
|
|
1383
|
-
* @since v11.0.0
|
|
1384
|
-
*/
|
|
1385
|
-
var TextEncoder: typeof globalThis extends {
|
|
1386
|
-
onmessage: any;
|
|
1387
|
-
TextEncoder: infer TextEncoder;
|
|
1388
|
-
} ? TextEncoder
|
|
1389
|
-
: typeof _TextEncoder;
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1283
|
+
/** @deprecated This alias will be removed in a future version. Use the canonical `TextEncoderEncodeIntoResult` instead. */
|
|
1284
|
+
// TODO: remove in future major
|
|
1285
|
+
export interface EncodeIntoResult extends TextEncoderEncodeIntoResult {}
|
|
1392
1286
|
//// parseArgs
|
|
1393
1287
|
/**
|
|
1394
1288
|
* Provides a higher level API for command-line argument parsing than interacting
|
|
@@ -1419,12 +1313,10 @@ declare module "util" {
|
|
|
1419
1313
|
* @return The parsed command line arguments:
|
|
1420
1314
|
*/
|
|
1421
1315
|
export function parseArgs<T extends ParseArgsConfig>(config?: T): ParsedResults<T>;
|
|
1422
|
-
|
|
1423
1316
|
/**
|
|
1424
1317
|
* Type of argument used in {@link parseArgs}.
|
|
1425
1318
|
*/
|
|
1426
1319
|
export type ParseArgsOptionsType = "boolean" | "string";
|
|
1427
|
-
|
|
1428
1320
|
export interface ParseArgsOptionDescriptor {
|
|
1429
1321
|
/**
|
|
1430
1322
|
* Type of argument.
|
|
@@ -1499,23 +1391,19 @@ declare module "util" {
|
|
|
1499
1391
|
type IfDefaultsTrue<T, IfTrue, IfFalse> = T extends true ? IfTrue
|
|
1500
1392
|
: T extends false ? IfFalse
|
|
1501
1393
|
: IfTrue;
|
|
1502
|
-
|
|
1503
1394
|
// we put the `extends false` condition first here because `undefined` compares like `any` when `strictNullChecks: false`
|
|
1504
1395
|
type IfDefaultsFalse<T, IfTrue, IfFalse> = T extends false ? IfFalse
|
|
1505
1396
|
: T extends true ? IfTrue
|
|
1506
1397
|
: IfFalse;
|
|
1507
|
-
|
|
1508
1398
|
type ExtractOptionValue<T extends ParseArgsConfig, O extends ParseArgsOptionDescriptor> = IfDefaultsTrue<
|
|
1509
1399
|
T["strict"],
|
|
1510
1400
|
O["type"] extends "string" ? string : O["type"] extends "boolean" ? boolean : string | boolean,
|
|
1511
1401
|
string | boolean
|
|
1512
1402
|
>;
|
|
1513
|
-
|
|
1514
1403
|
type ApplyOptionalModifiers<O extends ParseArgsOptionsConfig, V extends Record<keyof O, unknown>> = (
|
|
1515
1404
|
& { -readonly [LongOption in keyof O]?: V[LongOption] }
|
|
1516
1405
|
& { [LongOption in keyof O as O[LongOption]["default"] extends {} ? LongOption : never]: V[LongOption] }
|
|
1517
1406
|
) extends infer P ? { [K in keyof P]: P[K] } : never; // resolve intersection to object
|
|
1518
|
-
|
|
1519
1407
|
type ParsedValues<T extends ParseArgsConfig> =
|
|
1520
1408
|
& IfDefaultsTrue<T["strict"], unknown, { [longOption: string]: undefined | string | boolean }>
|
|
1521
1409
|
& (T["options"] extends ParseArgsOptionsConfig ? ApplyOptionalModifiers<
|
|
@@ -1529,13 +1417,11 @@ declare module "util" {
|
|
|
1529
1417
|
}
|
|
1530
1418
|
>
|
|
1531
1419
|
: {});
|
|
1532
|
-
|
|
1533
1420
|
type ParsedPositionals<T extends ParseArgsConfig> = IfDefaultsTrue<
|
|
1534
1421
|
T["strict"],
|
|
1535
1422
|
IfDefaultsFalse<T["allowPositionals"], string[], []>,
|
|
1536
1423
|
IfDefaultsTrue<T["allowPositionals"], string[], []>
|
|
1537
1424
|
>;
|
|
1538
|
-
|
|
1539
1425
|
type PreciseTokenForOptions<
|
|
1540
1426
|
K extends string,
|
|
1541
1427
|
O extends ParseArgsOptionDescriptor,
|
|
@@ -1556,7 +1442,6 @@ declare module "util" {
|
|
|
1556
1442
|
inlineValue: undefined;
|
|
1557
1443
|
}
|
|
1558
1444
|
: OptionToken & { name: K };
|
|
1559
|
-
|
|
1560
1445
|
type TokenForOptions<
|
|
1561
1446
|
T extends ParseArgsConfig,
|
|
1562
1447
|
K extends keyof T["options"] = keyof T["options"],
|
|
@@ -1564,19 +1449,15 @@ declare module "util" {
|
|
|
1564
1449
|
? T["options"] extends ParseArgsOptionsConfig ? PreciseTokenForOptions<K & string, T["options"][K]>
|
|
1565
1450
|
: OptionToken
|
|
1566
1451
|
: never;
|
|
1567
|
-
|
|
1568
1452
|
type ParsedOptionToken<T extends ParseArgsConfig> = IfDefaultsTrue<T["strict"], TokenForOptions<T>, OptionToken>;
|
|
1569
|
-
|
|
1570
1453
|
type ParsedPositionalToken<T extends ParseArgsConfig> = IfDefaultsTrue<
|
|
1571
1454
|
T["strict"],
|
|
1572
1455
|
IfDefaultsFalse<T["allowPositionals"], { kind: "positional"; index: number; value: string }, never>,
|
|
1573
1456
|
IfDefaultsTrue<T["allowPositionals"], { kind: "positional"; index: number; value: string }, never>
|
|
1574
1457
|
>;
|
|
1575
|
-
|
|
1576
1458
|
type ParsedTokens<T extends ParseArgsConfig> = Array<
|
|
1577
1459
|
ParsedOptionToken<T> | ParsedPositionalToken<T> | { kind: "option-terminator"; index: number }
|
|
1578
1460
|
>;
|
|
1579
|
-
|
|
1580
1461
|
type PreciseParsedResults<T extends ParseArgsConfig> = IfDefaultsFalse<
|
|
1581
1462
|
T["tokens"],
|
|
1582
1463
|
{
|
|
@@ -1589,7 +1470,6 @@ declare module "util" {
|
|
|
1589
1470
|
positionals: ParsedPositionals<T>;
|
|
1590
1471
|
}
|
|
1591
1472
|
>;
|
|
1592
|
-
|
|
1593
1473
|
type OptionToken =
|
|
1594
1474
|
| { kind: "option"; index: number; name: string; rawName: string; value: string; inlineValue: boolean }
|
|
1595
1475
|
| {
|
|
@@ -1600,12 +1480,10 @@ declare module "util" {
|
|
|
1600
1480
|
value: undefined;
|
|
1601
1481
|
inlineValue: undefined;
|
|
1602
1482
|
};
|
|
1603
|
-
|
|
1604
1483
|
type Token =
|
|
1605
1484
|
| OptionToken
|
|
1606
1485
|
| { kind: "positional"; index: number; value: string }
|
|
1607
1486
|
| { kind: "option-terminator"; index: number };
|
|
1608
|
-
|
|
1609
1487
|
// If ParseArgsConfig extends T, then the user passed config constructed elsewhere.
|
|
1610
1488
|
// So we can't rely on the `"not definitely present" implies "definitely not present"` assumption mentioned above.
|
|
1611
1489
|
type ParsedResults<T extends ParseArgsConfig> = ParseArgsConfig extends T ? {
|
|
@@ -1616,7 +1494,6 @@ declare module "util" {
|
|
|
1616
1494
|
tokens?: Token[];
|
|
1617
1495
|
}
|
|
1618
1496
|
: PreciseParsedResults<T>;
|
|
1619
|
-
|
|
1620
1497
|
/**
|
|
1621
1498
|
* An implementation of [the MIMEType class](https://bmeck.github.io/node-proposal-mime-api/).
|
|
1622
1499
|
*
|
|
@@ -1638,7 +1515,6 @@ declare module "util" {
|
|
|
1638
1515
|
* @param input The input MIME to parse.
|
|
1639
1516
|
*/
|
|
1640
1517
|
constructor(input: string | { toString: () => string });
|
|
1641
|
-
|
|
1642
1518
|
/**
|
|
1643
1519
|
* Gets and sets the type portion of the MIME.
|
|
1644
1520
|
*
|
|
@@ -1769,565 +1645,43 @@ declare module "util" {
|
|
|
1769
1645
|
*/
|
|
1770
1646
|
[Symbol.iterator](): NodeJS.Iterator<[name: string, value: string]>;
|
|
1771
1647
|
}
|
|
1648
|
+
// #region web types
|
|
1649
|
+
export interface TextDecodeOptions {
|
|
1650
|
+
stream?: boolean;
|
|
1651
|
+
}
|
|
1652
|
+
export interface TextDecoderCommon {
|
|
1653
|
+
readonly encoding: string;
|
|
1654
|
+
readonly fatal: boolean;
|
|
1655
|
+
readonly ignoreBOM: boolean;
|
|
1656
|
+
}
|
|
1657
|
+
export interface TextDecoderOptions {
|
|
1658
|
+
fatal?: boolean;
|
|
1659
|
+
ignoreBOM?: boolean;
|
|
1660
|
+
}
|
|
1661
|
+
export interface TextEncoderCommon {
|
|
1662
|
+
readonly encoding: string;
|
|
1663
|
+
}
|
|
1664
|
+
export interface TextEncoderEncodeIntoResult {
|
|
1665
|
+
read: number;
|
|
1666
|
+
written: number;
|
|
1667
|
+
}
|
|
1668
|
+
export interface TextDecoder extends TextDecoderCommon {
|
|
1669
|
+
decode(input?: NodeJS.AllowSharedBufferSource, options?: TextDecodeOptions): string;
|
|
1670
|
+
}
|
|
1671
|
+
export var TextDecoder: {
|
|
1672
|
+
prototype: TextDecoder;
|
|
1673
|
+
new(label?: string, options?: TextDecoderOptions): TextDecoder;
|
|
1674
|
+
};
|
|
1675
|
+
export interface TextEncoder extends TextEncoderCommon {
|
|
1676
|
+
encode(input?: string): NodeJS.NonSharedUint8Array;
|
|
1677
|
+
encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult;
|
|
1678
|
+
}
|
|
1679
|
+
export var TextEncoder: {
|
|
1680
|
+
prototype: TextEncoder;
|
|
1681
|
+
new(): TextEncoder;
|
|
1682
|
+
};
|
|
1683
|
+
// #endregion
|
|
1772
1684
|
}
|
|
1773
|
-
declare module "util
|
|
1774
|
-
|
|
1775
|
-
/**
|
|
1776
|
-
* Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) or
|
|
1777
|
-
* [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance.
|
|
1778
|
-
*
|
|
1779
|
-
* See also `util.types.isArrayBuffer()` and `util.types.isSharedArrayBuffer()`.
|
|
1780
|
-
*
|
|
1781
|
-
* ```js
|
|
1782
|
-
* util.types.isAnyArrayBuffer(new ArrayBuffer()); // Returns true
|
|
1783
|
-
* util.types.isAnyArrayBuffer(new SharedArrayBuffer()); // Returns true
|
|
1784
|
-
* ```
|
|
1785
|
-
* @since v10.0.0
|
|
1786
|
-
*/
|
|
1787
|
-
function isAnyArrayBuffer(object: unknown): object is ArrayBufferLike;
|
|
1788
|
-
/**
|
|
1789
|
-
* Returns `true` if the value is an `arguments` object.
|
|
1790
|
-
*
|
|
1791
|
-
* ```js
|
|
1792
|
-
* function foo() {
|
|
1793
|
-
* util.types.isArgumentsObject(arguments); // Returns true
|
|
1794
|
-
* }
|
|
1795
|
-
* ```
|
|
1796
|
-
* @since v10.0.0
|
|
1797
|
-
*/
|
|
1798
|
-
function isArgumentsObject(object: unknown): object is IArguments;
|
|
1799
|
-
/**
|
|
1800
|
-
* Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instance.
|
|
1801
|
-
* This does _not_ include [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instances. Usually, it is
|
|
1802
|
-
* desirable to test for both; See `util.types.isAnyArrayBuffer()` for that.
|
|
1803
|
-
*
|
|
1804
|
-
* ```js
|
|
1805
|
-
* util.types.isArrayBuffer(new ArrayBuffer()); // Returns true
|
|
1806
|
-
* util.types.isArrayBuffer(new SharedArrayBuffer()); // Returns false
|
|
1807
|
-
* ```
|
|
1808
|
-
* @since v10.0.0
|
|
1809
|
-
*/
|
|
1810
|
-
function isArrayBuffer(object: unknown): object is ArrayBuffer;
|
|
1811
|
-
/**
|
|
1812
|
-
* Returns `true` if the value is an instance of one of the [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) views, such as typed
|
|
1813
|
-
* array objects or [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView). Equivalent to
|
|
1814
|
-
* [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
|
|
1815
|
-
*
|
|
1816
|
-
* ```js
|
|
1817
|
-
* util.types.isArrayBufferView(new Int8Array()); // true
|
|
1818
|
-
* util.types.isArrayBufferView(Buffer.from('hello world')); // true
|
|
1819
|
-
* util.types.isArrayBufferView(new DataView(new ArrayBuffer(16))); // true
|
|
1820
|
-
* util.types.isArrayBufferView(new ArrayBuffer()); // false
|
|
1821
|
-
* ```
|
|
1822
|
-
* @since v10.0.0
|
|
1823
|
-
*/
|
|
1824
|
-
function isArrayBufferView(object: unknown): object is NodeJS.ArrayBufferView;
|
|
1825
|
-
/**
|
|
1826
|
-
* Returns `true` if the value is an [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function).
|
|
1827
|
-
* This only reports back what the JavaScript engine is seeing;
|
|
1828
|
-
* in particular, the return value may not match the original source code if
|
|
1829
|
-
* a transpilation tool was used.
|
|
1830
|
-
*
|
|
1831
|
-
* ```js
|
|
1832
|
-
* util.types.isAsyncFunction(function foo() {}); // Returns false
|
|
1833
|
-
* util.types.isAsyncFunction(async function foo() {}); // Returns true
|
|
1834
|
-
* ```
|
|
1835
|
-
* @since v10.0.0
|
|
1836
|
-
*/
|
|
1837
|
-
function isAsyncFunction(object: unknown): boolean;
|
|
1838
|
-
/**
|
|
1839
|
-
* Returns `true` if the value is a `BigInt64Array` instance.
|
|
1840
|
-
*
|
|
1841
|
-
* ```js
|
|
1842
|
-
* util.types.isBigInt64Array(new BigInt64Array()); // Returns true
|
|
1843
|
-
* util.types.isBigInt64Array(new BigUint64Array()); // Returns false
|
|
1844
|
-
* ```
|
|
1845
|
-
* @since v10.0.0
|
|
1846
|
-
*/
|
|
1847
|
-
function isBigInt64Array(value: unknown): value is BigInt64Array;
|
|
1848
|
-
/**
|
|
1849
|
-
* Returns `true` if the value is a BigInt object, e.g. created
|
|
1850
|
-
* by `Object(BigInt(123))`.
|
|
1851
|
-
*
|
|
1852
|
-
* ```js
|
|
1853
|
-
* util.types.isBigIntObject(Object(BigInt(123))); // Returns true
|
|
1854
|
-
* util.types.isBigIntObject(BigInt(123)); // Returns false
|
|
1855
|
-
* util.types.isBigIntObject(123); // Returns false
|
|
1856
|
-
* ```
|
|
1857
|
-
* @since v10.4.0
|
|
1858
|
-
*/
|
|
1859
|
-
function isBigIntObject(object: unknown): object is BigInt;
|
|
1860
|
-
/**
|
|
1861
|
-
* Returns `true` if the value is a `BigUint64Array` instance.
|
|
1862
|
-
*
|
|
1863
|
-
* ```js
|
|
1864
|
-
* util.types.isBigUint64Array(new BigInt64Array()); // Returns false
|
|
1865
|
-
* util.types.isBigUint64Array(new BigUint64Array()); // Returns true
|
|
1866
|
-
* ```
|
|
1867
|
-
* @since v10.0.0
|
|
1868
|
-
*/
|
|
1869
|
-
function isBigUint64Array(value: unknown): value is BigUint64Array;
|
|
1870
|
-
/**
|
|
1871
|
-
* Returns `true` if the value is a boolean object, e.g. created
|
|
1872
|
-
* by `new Boolean()`.
|
|
1873
|
-
*
|
|
1874
|
-
* ```js
|
|
1875
|
-
* util.types.isBooleanObject(false); // Returns false
|
|
1876
|
-
* util.types.isBooleanObject(true); // Returns false
|
|
1877
|
-
* util.types.isBooleanObject(new Boolean(false)); // Returns true
|
|
1878
|
-
* util.types.isBooleanObject(new Boolean(true)); // Returns true
|
|
1879
|
-
* util.types.isBooleanObject(Boolean(false)); // Returns false
|
|
1880
|
-
* util.types.isBooleanObject(Boolean(true)); // Returns false
|
|
1881
|
-
* ```
|
|
1882
|
-
* @since v10.0.0
|
|
1883
|
-
*/
|
|
1884
|
-
function isBooleanObject(object: unknown): object is Boolean;
|
|
1885
|
-
/**
|
|
1886
|
-
* Returns `true` if the value is any boxed primitive object, e.g. created
|
|
1887
|
-
* by `new Boolean()`, `new String()` or `Object(Symbol())`.
|
|
1888
|
-
*
|
|
1889
|
-
* For example:
|
|
1890
|
-
*
|
|
1891
|
-
* ```js
|
|
1892
|
-
* util.types.isBoxedPrimitive(false); // Returns false
|
|
1893
|
-
* util.types.isBoxedPrimitive(new Boolean(false)); // Returns true
|
|
1894
|
-
* util.types.isBoxedPrimitive(Symbol('foo')); // Returns false
|
|
1895
|
-
* util.types.isBoxedPrimitive(Object(Symbol('foo'))); // Returns true
|
|
1896
|
-
* util.types.isBoxedPrimitive(Object(BigInt(5))); // Returns true
|
|
1897
|
-
* ```
|
|
1898
|
-
* @since v10.11.0
|
|
1899
|
-
*/
|
|
1900
|
-
function isBoxedPrimitive(object: unknown): object is String | Number | BigInt | Boolean | Symbol;
|
|
1901
|
-
/**
|
|
1902
|
-
* Returns `true` if the value is a built-in [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) instance.
|
|
1903
|
-
*
|
|
1904
|
-
* ```js
|
|
1905
|
-
* const ab = new ArrayBuffer(20);
|
|
1906
|
-
* util.types.isDataView(new DataView(ab)); // Returns true
|
|
1907
|
-
* util.types.isDataView(new Float64Array()); // Returns false
|
|
1908
|
-
* ```
|
|
1909
|
-
*
|
|
1910
|
-
* See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
|
|
1911
|
-
* @since v10.0.0
|
|
1912
|
-
*/
|
|
1913
|
-
function isDataView(object: unknown): object is DataView;
|
|
1914
|
-
/**
|
|
1915
|
-
* Returns `true` if the value is a built-in [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) instance.
|
|
1916
|
-
*
|
|
1917
|
-
* ```js
|
|
1918
|
-
* util.types.isDate(new Date()); // Returns true
|
|
1919
|
-
* ```
|
|
1920
|
-
* @since v10.0.0
|
|
1921
|
-
*/
|
|
1922
|
-
function isDate(object: unknown): object is Date;
|
|
1923
|
-
/**
|
|
1924
|
-
* Returns `true` if the value is a native `External` value.
|
|
1925
|
-
*
|
|
1926
|
-
* A native `External` value is a special type of object that contains a
|
|
1927
|
-
* raw C++ pointer (`void*`) for access from native code, and has no other
|
|
1928
|
-
* properties. Such objects are created either by Node.js internals or native
|
|
1929
|
-
* addons. In JavaScript, they are
|
|
1930
|
-
* [frozen](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze) objects with a
|
|
1931
|
-
* `null` prototype.
|
|
1932
|
-
*
|
|
1933
|
-
* ```c
|
|
1934
|
-
* #include <js_native_api.h>
|
|
1935
|
-
* #include <stdlib.h>
|
|
1936
|
-
* napi_value result;
|
|
1937
|
-
* static napi_value MyNapi(napi_env env, napi_callback_info info) {
|
|
1938
|
-
* int* raw = (int*) malloc(1024);
|
|
1939
|
-
* napi_status status = napi_create_external(env, (void*) raw, NULL, NULL, &result);
|
|
1940
|
-
* if (status != napi_ok) {
|
|
1941
|
-
* napi_throw_error(env, NULL, "napi_create_external failed");
|
|
1942
|
-
* return NULL;
|
|
1943
|
-
* }
|
|
1944
|
-
* return result;
|
|
1945
|
-
* }
|
|
1946
|
-
* ...
|
|
1947
|
-
* DECLARE_NAPI_PROPERTY("myNapi", MyNapi)
|
|
1948
|
-
* ...
|
|
1949
|
-
* ```
|
|
1950
|
-
*
|
|
1951
|
-
* ```js
|
|
1952
|
-
* import native from 'napi_addon.node';
|
|
1953
|
-
* import { types } from 'node:util';
|
|
1954
|
-
*
|
|
1955
|
-
* const data = native.myNapi();
|
|
1956
|
-
* types.isExternal(data); // returns true
|
|
1957
|
-
* types.isExternal(0); // returns false
|
|
1958
|
-
* types.isExternal(new String('foo')); // returns false
|
|
1959
|
-
* ```
|
|
1960
|
-
*
|
|
1961
|
-
* For further information on `napi_create_external`, refer to
|
|
1962
|
-
* [`napi_create_external()`](https://nodejs.org/docs/latest-v24.x/api/n-api.html#napi_create_external).
|
|
1963
|
-
* @since v10.0.0
|
|
1964
|
-
*/
|
|
1965
|
-
function isExternal(object: unknown): boolean;
|
|
1966
|
-
/**
|
|
1967
|
-
* Returns `true` if the value is a built-in [`Float16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float16Array) instance.
|
|
1968
|
-
*
|
|
1969
|
-
* ```js
|
|
1970
|
-
* util.types.isFloat16Array(new ArrayBuffer()); // Returns false
|
|
1971
|
-
* util.types.isFloat16Array(new Float16Array()); // Returns true
|
|
1972
|
-
* util.types.isFloat16Array(new Float32Array()); // Returns false
|
|
1973
|
-
* ```
|
|
1974
|
-
* @since v24.0.0
|
|
1975
|
-
*/
|
|
1976
|
-
function isFloat16Array(object: unknown): object is Float16Array;
|
|
1977
|
-
/**
|
|
1978
|
-
* Returns `true` if the value is a built-in [`Float32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array) instance.
|
|
1979
|
-
*
|
|
1980
|
-
* ```js
|
|
1981
|
-
* util.types.isFloat32Array(new ArrayBuffer()); // Returns false
|
|
1982
|
-
* util.types.isFloat32Array(new Float32Array()); // Returns true
|
|
1983
|
-
* util.types.isFloat32Array(new Float64Array()); // Returns false
|
|
1984
|
-
* ```
|
|
1985
|
-
* @since v10.0.0
|
|
1986
|
-
*/
|
|
1987
|
-
function isFloat32Array(object: unknown): object is Float32Array;
|
|
1988
|
-
/**
|
|
1989
|
-
* Returns `true` if the value is a built-in [`Float64Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array) instance.
|
|
1990
|
-
*
|
|
1991
|
-
* ```js
|
|
1992
|
-
* util.types.isFloat64Array(new ArrayBuffer()); // Returns false
|
|
1993
|
-
* util.types.isFloat64Array(new Uint8Array()); // Returns false
|
|
1994
|
-
* util.types.isFloat64Array(new Float64Array()); // Returns true
|
|
1995
|
-
* ```
|
|
1996
|
-
* @since v10.0.0
|
|
1997
|
-
*/
|
|
1998
|
-
function isFloat64Array(object: unknown): object is Float64Array;
|
|
1999
|
-
/**
|
|
2000
|
-
* Returns `true` if the value is a generator function.
|
|
2001
|
-
* This only reports back what the JavaScript engine is seeing;
|
|
2002
|
-
* in particular, the return value may not match the original source code if
|
|
2003
|
-
* a transpilation tool was used.
|
|
2004
|
-
*
|
|
2005
|
-
* ```js
|
|
2006
|
-
* util.types.isGeneratorFunction(function foo() {}); // Returns false
|
|
2007
|
-
* util.types.isGeneratorFunction(function* foo() {}); // Returns true
|
|
2008
|
-
* ```
|
|
2009
|
-
* @since v10.0.0
|
|
2010
|
-
*/
|
|
2011
|
-
function isGeneratorFunction(object: unknown): object is GeneratorFunction;
|
|
2012
|
-
/**
|
|
2013
|
-
* Returns `true` if the value is a generator object as returned from a
|
|
2014
|
-
* built-in generator function.
|
|
2015
|
-
* This only reports back what the JavaScript engine is seeing;
|
|
2016
|
-
* in particular, the return value may not match the original source code if
|
|
2017
|
-
* a transpilation tool was used.
|
|
2018
|
-
*
|
|
2019
|
-
* ```js
|
|
2020
|
-
* function* foo() {}
|
|
2021
|
-
* const generator = foo();
|
|
2022
|
-
* util.types.isGeneratorObject(generator); // Returns true
|
|
2023
|
-
* ```
|
|
2024
|
-
* @since v10.0.0
|
|
2025
|
-
*/
|
|
2026
|
-
function isGeneratorObject(object: unknown): object is Generator;
|
|
2027
|
-
/**
|
|
2028
|
-
* Returns `true` if the value is a built-in [`Int8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array) instance.
|
|
2029
|
-
*
|
|
2030
|
-
* ```js
|
|
2031
|
-
* util.types.isInt8Array(new ArrayBuffer()); // Returns false
|
|
2032
|
-
* util.types.isInt8Array(new Int8Array()); // Returns true
|
|
2033
|
-
* util.types.isInt8Array(new Float64Array()); // Returns false
|
|
2034
|
-
* ```
|
|
2035
|
-
* @since v10.0.0
|
|
2036
|
-
*/
|
|
2037
|
-
function isInt8Array(object: unknown): object is Int8Array;
|
|
2038
|
-
/**
|
|
2039
|
-
* Returns `true` if the value is a built-in [`Int16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array) instance.
|
|
2040
|
-
*
|
|
2041
|
-
* ```js
|
|
2042
|
-
* util.types.isInt16Array(new ArrayBuffer()); // Returns false
|
|
2043
|
-
* util.types.isInt16Array(new Int16Array()); // Returns true
|
|
2044
|
-
* util.types.isInt16Array(new Float64Array()); // Returns false
|
|
2045
|
-
* ```
|
|
2046
|
-
* @since v10.0.0
|
|
2047
|
-
*/
|
|
2048
|
-
function isInt16Array(object: unknown): object is Int16Array;
|
|
2049
|
-
/**
|
|
2050
|
-
* Returns `true` if the value is a built-in [`Int32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array) instance.
|
|
2051
|
-
*
|
|
2052
|
-
* ```js
|
|
2053
|
-
* util.types.isInt32Array(new ArrayBuffer()); // Returns false
|
|
2054
|
-
* util.types.isInt32Array(new Int32Array()); // Returns true
|
|
2055
|
-
* util.types.isInt32Array(new Float64Array()); // Returns false
|
|
2056
|
-
* ```
|
|
2057
|
-
* @since v10.0.0
|
|
2058
|
-
*/
|
|
2059
|
-
function isInt32Array(object: unknown): object is Int32Array;
|
|
2060
|
-
/**
|
|
2061
|
-
* Returns `true` if the value is a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance.
|
|
2062
|
-
*
|
|
2063
|
-
* ```js
|
|
2064
|
-
* util.types.isMap(new Map()); // Returns true
|
|
2065
|
-
* ```
|
|
2066
|
-
* @since v10.0.0
|
|
2067
|
-
*/
|
|
2068
|
-
function isMap<T>(
|
|
2069
|
-
object: T | {},
|
|
2070
|
-
): object is T extends ReadonlyMap<any, any> ? (unknown extends T ? never : ReadonlyMap<any, any>)
|
|
2071
|
-
: Map<unknown, unknown>;
|
|
2072
|
-
/**
|
|
2073
|
-
* Returns `true` if the value is an iterator returned for a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance.
|
|
2074
|
-
*
|
|
2075
|
-
* ```js
|
|
2076
|
-
* const map = new Map();
|
|
2077
|
-
* util.types.isMapIterator(map.keys()); // Returns true
|
|
2078
|
-
* util.types.isMapIterator(map.values()); // Returns true
|
|
2079
|
-
* util.types.isMapIterator(map.entries()); // Returns true
|
|
2080
|
-
* util.types.isMapIterator(map[Symbol.iterator]()); // Returns true
|
|
2081
|
-
* ```
|
|
2082
|
-
* @since v10.0.0
|
|
2083
|
-
*/
|
|
2084
|
-
function isMapIterator(object: unknown): boolean;
|
|
2085
|
-
/**
|
|
2086
|
-
* Returns `true` if the value is an instance of a [Module Namespace Object](https://tc39.github.io/ecma262/#sec-module-namespace-exotic-objects).
|
|
2087
|
-
*
|
|
2088
|
-
* ```js
|
|
2089
|
-
* import * as ns from './a.js';
|
|
2090
|
-
*
|
|
2091
|
-
* util.types.isModuleNamespaceObject(ns); // Returns true
|
|
2092
|
-
* ```
|
|
2093
|
-
* @since v10.0.0
|
|
2094
|
-
*/
|
|
2095
|
-
function isModuleNamespaceObject(value: unknown): boolean;
|
|
2096
|
-
/**
|
|
2097
|
-
* Returns `true` if the value was returned by the constructor of a
|
|
2098
|
-
* [built-in `Error` type](https://tc39.es/ecma262/#sec-error-objects).
|
|
2099
|
-
*
|
|
2100
|
-
* ```js
|
|
2101
|
-
* console.log(util.types.isNativeError(new Error())); // true
|
|
2102
|
-
* console.log(util.types.isNativeError(new TypeError())); // true
|
|
2103
|
-
* console.log(util.types.isNativeError(new RangeError())); // true
|
|
2104
|
-
* ```
|
|
2105
|
-
*
|
|
2106
|
-
* Subclasses of the native error types are also native errors:
|
|
2107
|
-
*
|
|
2108
|
-
* ```js
|
|
2109
|
-
* class MyError extends Error {}
|
|
2110
|
-
* console.log(util.types.isNativeError(new MyError())); // true
|
|
2111
|
-
* ```
|
|
2112
|
-
*
|
|
2113
|
-
* A value being `instanceof` a native error class is not equivalent to `isNativeError()`
|
|
2114
|
-
* returning `true` for that value. `isNativeError()` returns `true` for errors
|
|
2115
|
-
* which come from a different [realm](https://tc39.es/ecma262/#realm) while `instanceof Error` returns `false`
|
|
2116
|
-
* for these errors:
|
|
2117
|
-
*
|
|
2118
|
-
* ```js
|
|
2119
|
-
* import { createContext, runInContext } from 'node:vm';
|
|
2120
|
-
* import { types } from 'node:util';
|
|
2121
|
-
*
|
|
2122
|
-
* const context = createContext({});
|
|
2123
|
-
* const myError = runInContext('new Error()', context);
|
|
2124
|
-
* console.log(types.isNativeError(myError)); // true
|
|
2125
|
-
* console.log(myError instanceof Error); // false
|
|
2126
|
-
* ```
|
|
2127
|
-
*
|
|
2128
|
-
* Conversely, `isNativeError()` returns `false` for all objects which were not
|
|
2129
|
-
* returned by the constructor of a native error. That includes values
|
|
2130
|
-
* which are `instanceof` native errors:
|
|
2131
|
-
*
|
|
2132
|
-
* ```js
|
|
2133
|
-
* const myError = { __proto__: Error.prototype };
|
|
2134
|
-
* console.log(util.types.isNativeError(myError)); // false
|
|
2135
|
-
* console.log(myError instanceof Error); // true
|
|
2136
|
-
* ```
|
|
2137
|
-
* @since v10.0.0
|
|
2138
|
-
* @deprecated The `util.types.isNativeError` API is deprecated. Please use `Error.isError` instead.
|
|
2139
|
-
*/
|
|
2140
|
-
function isNativeError(object: unknown): object is Error;
|
|
2141
|
-
/**
|
|
2142
|
-
* Returns `true` if the value is a number object, e.g. created
|
|
2143
|
-
* by `new Number()`.
|
|
2144
|
-
*
|
|
2145
|
-
* ```js
|
|
2146
|
-
* util.types.isNumberObject(0); // Returns false
|
|
2147
|
-
* util.types.isNumberObject(new Number(0)); // Returns true
|
|
2148
|
-
* ```
|
|
2149
|
-
* @since v10.0.0
|
|
2150
|
-
*/
|
|
2151
|
-
function isNumberObject(object: unknown): object is Number;
|
|
2152
|
-
/**
|
|
2153
|
-
* Returns `true` if the value is a built-in [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
|
|
2154
|
-
*
|
|
2155
|
-
* ```js
|
|
2156
|
-
* util.types.isPromise(Promise.resolve(42)); // Returns true
|
|
2157
|
-
* ```
|
|
2158
|
-
* @since v10.0.0
|
|
2159
|
-
*/
|
|
2160
|
-
function isPromise(object: unknown): object is Promise<unknown>;
|
|
2161
|
-
/**
|
|
2162
|
-
* Returns `true` if the value is a [`Proxy`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) instance.
|
|
2163
|
-
*
|
|
2164
|
-
* ```js
|
|
2165
|
-
* const target = {};
|
|
2166
|
-
* const proxy = new Proxy(target, {});
|
|
2167
|
-
* util.types.isProxy(target); // Returns false
|
|
2168
|
-
* util.types.isProxy(proxy); // Returns true
|
|
2169
|
-
* ```
|
|
2170
|
-
* @since v10.0.0
|
|
2171
|
-
*/
|
|
2172
|
-
function isProxy(object: unknown): boolean;
|
|
2173
|
-
/**
|
|
2174
|
-
* Returns `true` if the value is a regular expression object.
|
|
2175
|
-
*
|
|
2176
|
-
* ```js
|
|
2177
|
-
* util.types.isRegExp(/abc/); // Returns true
|
|
2178
|
-
* util.types.isRegExp(new RegExp('abc')); // Returns true
|
|
2179
|
-
* ```
|
|
2180
|
-
* @since v10.0.0
|
|
2181
|
-
*/
|
|
2182
|
-
function isRegExp(object: unknown): object is RegExp;
|
|
2183
|
-
/**
|
|
2184
|
-
* Returns `true` if the value is a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance.
|
|
2185
|
-
*
|
|
2186
|
-
* ```js
|
|
2187
|
-
* util.types.isSet(new Set()); // Returns true
|
|
2188
|
-
* ```
|
|
2189
|
-
* @since v10.0.0
|
|
2190
|
-
*/
|
|
2191
|
-
function isSet<T>(
|
|
2192
|
-
object: T | {},
|
|
2193
|
-
): object is T extends ReadonlySet<any> ? (unknown extends T ? never : ReadonlySet<any>) : Set<unknown>;
|
|
2194
|
-
/**
|
|
2195
|
-
* Returns `true` if the value is an iterator returned for a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance.
|
|
2196
|
-
*
|
|
2197
|
-
* ```js
|
|
2198
|
-
* const set = new Set();
|
|
2199
|
-
* util.types.isSetIterator(set.keys()); // Returns true
|
|
2200
|
-
* util.types.isSetIterator(set.values()); // Returns true
|
|
2201
|
-
* util.types.isSetIterator(set.entries()); // Returns true
|
|
2202
|
-
* util.types.isSetIterator(set[Symbol.iterator]()); // Returns true
|
|
2203
|
-
* ```
|
|
2204
|
-
* @since v10.0.0
|
|
2205
|
-
*/
|
|
2206
|
-
function isSetIterator(object: unknown): boolean;
|
|
2207
|
-
/**
|
|
2208
|
-
* Returns `true` if the value is a built-in [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance.
|
|
2209
|
-
* This does _not_ include [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instances. Usually, it is
|
|
2210
|
-
* desirable to test for both; See `util.types.isAnyArrayBuffer()` for that.
|
|
2211
|
-
*
|
|
2212
|
-
* ```js
|
|
2213
|
-
* util.types.isSharedArrayBuffer(new ArrayBuffer()); // Returns false
|
|
2214
|
-
* util.types.isSharedArrayBuffer(new SharedArrayBuffer()); // Returns true
|
|
2215
|
-
* ```
|
|
2216
|
-
* @since v10.0.0
|
|
2217
|
-
*/
|
|
2218
|
-
function isSharedArrayBuffer(object: unknown): object is SharedArrayBuffer;
|
|
2219
|
-
/**
|
|
2220
|
-
* Returns `true` if the value is a string object, e.g. created
|
|
2221
|
-
* by `new String()`.
|
|
2222
|
-
*
|
|
2223
|
-
* ```js
|
|
2224
|
-
* util.types.isStringObject('foo'); // Returns false
|
|
2225
|
-
* util.types.isStringObject(new String('foo')); // Returns true
|
|
2226
|
-
* ```
|
|
2227
|
-
* @since v10.0.0
|
|
2228
|
-
*/
|
|
2229
|
-
function isStringObject(object: unknown): object is String;
|
|
2230
|
-
/**
|
|
2231
|
-
* Returns `true` if the value is a symbol object, created
|
|
2232
|
-
* by calling `Object()` on a `Symbol` primitive.
|
|
2233
|
-
*
|
|
2234
|
-
* ```js
|
|
2235
|
-
* const symbol = Symbol('foo');
|
|
2236
|
-
* util.types.isSymbolObject(symbol); // Returns false
|
|
2237
|
-
* util.types.isSymbolObject(Object(symbol)); // Returns true
|
|
2238
|
-
* ```
|
|
2239
|
-
* @since v10.0.0
|
|
2240
|
-
*/
|
|
2241
|
-
function isSymbolObject(object: unknown): object is Symbol;
|
|
2242
|
-
/**
|
|
2243
|
-
* Returns `true` if the value is a built-in [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) instance.
|
|
2244
|
-
*
|
|
2245
|
-
* ```js
|
|
2246
|
-
* util.types.isTypedArray(new ArrayBuffer()); // Returns false
|
|
2247
|
-
* util.types.isTypedArray(new Uint8Array()); // Returns true
|
|
2248
|
-
* util.types.isTypedArray(new Float64Array()); // Returns true
|
|
2249
|
-
* ```
|
|
2250
|
-
*
|
|
2251
|
-
* See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
|
|
2252
|
-
* @since v10.0.0
|
|
2253
|
-
*/
|
|
2254
|
-
function isTypedArray(object: unknown): object is NodeJS.TypedArray;
|
|
2255
|
-
/**
|
|
2256
|
-
* Returns `true` if the value is a built-in [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) instance.
|
|
2257
|
-
*
|
|
2258
|
-
* ```js
|
|
2259
|
-
* util.types.isUint8Array(new ArrayBuffer()); // Returns false
|
|
2260
|
-
* util.types.isUint8Array(new Uint8Array()); // Returns true
|
|
2261
|
-
* util.types.isUint8Array(new Float64Array()); // Returns false
|
|
2262
|
-
* ```
|
|
2263
|
-
* @since v10.0.0
|
|
2264
|
-
*/
|
|
2265
|
-
function isUint8Array(object: unknown): object is Uint8Array;
|
|
2266
|
-
/**
|
|
2267
|
-
* Returns `true` if the value is a built-in [`Uint8ClampedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray) instance.
|
|
2268
|
-
*
|
|
2269
|
-
* ```js
|
|
2270
|
-
* util.types.isUint8ClampedArray(new ArrayBuffer()); // Returns false
|
|
2271
|
-
* util.types.isUint8ClampedArray(new Uint8ClampedArray()); // Returns true
|
|
2272
|
-
* util.types.isUint8ClampedArray(new Float64Array()); // Returns false
|
|
2273
|
-
* ```
|
|
2274
|
-
* @since v10.0.0
|
|
2275
|
-
*/
|
|
2276
|
-
function isUint8ClampedArray(object: unknown): object is Uint8ClampedArray;
|
|
2277
|
-
/**
|
|
2278
|
-
* Returns `true` if the value is a built-in [`Uint16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array) instance.
|
|
2279
|
-
*
|
|
2280
|
-
* ```js
|
|
2281
|
-
* util.types.isUint16Array(new ArrayBuffer()); // Returns false
|
|
2282
|
-
* util.types.isUint16Array(new Uint16Array()); // Returns true
|
|
2283
|
-
* util.types.isUint16Array(new Float64Array()); // Returns false
|
|
2284
|
-
* ```
|
|
2285
|
-
* @since v10.0.0
|
|
2286
|
-
*/
|
|
2287
|
-
function isUint16Array(object: unknown): object is Uint16Array;
|
|
2288
|
-
/**
|
|
2289
|
-
* Returns `true` if the value is a built-in [`Uint32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array) instance.
|
|
2290
|
-
*
|
|
2291
|
-
* ```js
|
|
2292
|
-
* util.types.isUint32Array(new ArrayBuffer()); // Returns false
|
|
2293
|
-
* util.types.isUint32Array(new Uint32Array()); // Returns true
|
|
2294
|
-
* util.types.isUint32Array(new Float64Array()); // Returns false
|
|
2295
|
-
* ```
|
|
2296
|
-
* @since v10.0.0
|
|
2297
|
-
*/
|
|
2298
|
-
function isUint32Array(object: unknown): object is Uint32Array;
|
|
2299
|
-
/**
|
|
2300
|
-
* Returns `true` if the value is a built-in [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) instance.
|
|
2301
|
-
*
|
|
2302
|
-
* ```js
|
|
2303
|
-
* util.types.isWeakMap(new WeakMap()); // Returns true
|
|
2304
|
-
* ```
|
|
2305
|
-
* @since v10.0.0
|
|
2306
|
-
*/
|
|
2307
|
-
function isWeakMap(object: unknown): object is WeakMap<object, unknown>;
|
|
2308
|
-
/**
|
|
2309
|
-
* Returns `true` if the value is a built-in [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) instance.
|
|
2310
|
-
*
|
|
2311
|
-
* ```js
|
|
2312
|
-
* util.types.isWeakSet(new WeakSet()); // Returns true
|
|
2313
|
-
* ```
|
|
2314
|
-
* @since v10.0.0
|
|
2315
|
-
*/
|
|
2316
|
-
function isWeakSet(object: unknown): object is WeakSet<object>;
|
|
2317
|
-
/**
|
|
2318
|
-
* Returns `true` if `value` is a `KeyObject`, `false` otherwise.
|
|
2319
|
-
* @since v16.2.0
|
|
2320
|
-
*/
|
|
2321
|
-
function isKeyObject(object: unknown): object is KeyObject;
|
|
2322
|
-
/**
|
|
2323
|
-
* Returns `true` if `value` is a `CryptoKey`, `false` otherwise.
|
|
2324
|
-
* @since v16.2.0
|
|
2325
|
-
*/
|
|
2326
|
-
function isCryptoKey(object: unknown): object is webcrypto.CryptoKey;
|
|
2327
|
-
}
|
|
2328
|
-
declare module "node:util" {
|
|
2329
|
-
export * from "util";
|
|
2330
|
-
}
|
|
2331
|
-
declare module "node:util/types" {
|
|
2332
|
-
export * from "util/types";
|
|
1685
|
+
declare module "util" {
|
|
1686
|
+
export * from "node:util";
|
|
2333
1687
|
}
|