cdk-common 2.0.1351 → 2.0.1352
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.
- package/.jsii +38 -2
- package/API.md +36 -0
- package/lib/main.js +1 -1
- package/lib/managed-policies.d.ts +7 -1
- package/lib/managed-policies.js +7 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/assert/strict.d.ts +5 -11
- package/node_modules/@types/concat-stream/node_modules/@types/node/assert.d.ts +9 -169
- package/node_modules/@types/concat-stream/node_modules/@types/node/async_hooks.d.ts +8 -8
- package/node_modules/@types/concat-stream/node_modules/@types/node/buffer.buffer.d.ts +1 -7
- package/node_modules/@types/concat-stream/node_modules/@types/node/buffer.d.ts +44 -168
- package/node_modules/@types/concat-stream/node_modules/@types/node/child_process.d.ts +16 -64
- package/node_modules/@types/concat-stream/node_modules/@types/node/cluster.d.ts +240 -332
- package/node_modules/@types/concat-stream/node_modules/@types/node/console.d.ts +49 -351
- package/node_modules/@types/concat-stream/node_modules/@types/node/constants.d.ts +3 -4
- package/node_modules/@types/concat-stream/node_modules/@types/node/crypto.d.ts +279 -1631
- package/node_modules/@types/concat-stream/node_modules/@types/node/dgram.d.ts +15 -51
- package/node_modules/@types/concat-stream/node_modules/@types/node/diagnostics_channel.d.ts +4 -4
- package/node_modules/@types/concat-stream/node_modules/@types/node/dns/promises.d.ts +3 -3
- package/node_modules/@types/concat-stream/node_modules/@types/node/dns.d.ts +131 -132
- package/node_modules/@types/concat-stream/node_modules/@types/node/domain.d.ts +13 -17
- package/node_modules/@types/concat-stream/node_modules/@types/node/events.d.ts +869 -791
- package/node_modules/@types/concat-stream/node_modules/@types/node/fs/promises.d.ts +7 -8
- package/node_modules/@types/concat-stream/node_modules/@types/node/fs.d.ts +417 -455
- package/node_modules/@types/concat-stream/node_modules/@types/node/globals.d.ts +6 -26
- package/node_modules/@types/concat-stream/node_modules/@types/node/globals.typedarray.d.ts +60 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/http.d.ts +263 -254
- package/node_modules/@types/concat-stream/node_modules/@types/node/http2.d.ts +528 -804
- package/node_modules/@types/concat-stream/node_modules/@types/node/https.d.ts +59 -239
- package/node_modules/@types/concat-stream/node_modules/@types/node/index.d.ts +15 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/inspector/promises.d.ts +41 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/inspector.d.ts +6 -59
- package/node_modules/@types/concat-stream/node_modules/@types/node/inspector.generated.d.ts +3 -10
- package/node_modules/@types/concat-stream/node_modules/@types/node/module.d.ts +47 -122
- package/node_modules/@types/concat-stream/node_modules/@types/node/net.d.ts +63 -184
- package/node_modules/@types/concat-stream/node_modules/@types/node/os.d.ts +6 -6
- package/node_modules/@types/concat-stream/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/path/posix.d.ts +8 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/path/win32.d.ts +8 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/path.d.ts +120 -133
- package/node_modules/@types/concat-stream/node_modules/@types/node/perf_hooks.d.ts +282 -643
- package/node_modules/@types/concat-stream/node_modules/@types/node/process.d.ts +156 -128
- package/node_modules/@types/concat-stream/node_modules/@types/node/punycode.d.ts +5 -5
- package/node_modules/@types/concat-stream/node_modules/@types/node/querystring.d.ts +4 -4
- package/node_modules/@types/concat-stream/node_modules/@types/node/quic.d.ts +910 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/readline/promises.d.ts +3 -3
- package/node_modules/@types/concat-stream/node_modules/@types/node/readline.d.ts +67 -120
- package/node_modules/@types/concat-stream/node_modules/@types/node/repl.d.ts +75 -98
- package/node_modules/@types/concat-stream/node_modules/@types/node/sea.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/sqlite.d.ts +2 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/stream/consumers.d.ts +10 -10
- package/node_modules/@types/concat-stream/node_modules/@types/node/stream/promises.d.ts +136 -15
- package/node_modules/@types/concat-stream/node_modules/@types/node/stream/web.d.ts +176 -453
- package/node_modules/@types/concat-stream/node_modules/@types/node/stream.d.ts +555 -478
- package/node_modules/@types/concat-stream/node_modules/@types/node/string_decoder.d.ts +4 -4
- package/node_modules/@types/concat-stream/node_modules/@types/node/test/reporters.d.ts +96 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/test.d.ts +80 -180
- package/node_modules/@types/concat-stream/node_modules/@types/node/timers/promises.d.ts +4 -4
- package/node_modules/@types/concat-stream/node_modules/@types/node/timers.d.ts +4 -130
- package/node_modules/@types/concat-stream/node_modules/@types/node/tls.d.ts +102 -177
- package/node_modules/@types/concat-stream/node_modules/@types/node/trace_events.d.ts +9 -9
- package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +1 -7
- package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.6/index.d.ts +15 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.7/index.d.ts +15 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/tty.d.ts +58 -16
- package/node_modules/@types/concat-stream/node_modules/@types/node/url.d.ts +54 -592
- package/node_modules/@types/concat-stream/node_modules/@types/node/util/types.d.ts +558 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/util.d.ts +120 -792
- package/node_modules/@types/concat-stream/node_modules/@types/node/v8.d.ts +32 -5
- package/node_modules/@types/concat-stream/node_modules/@types/node/vm.d.ts +13 -13
- package/node_modules/@types/concat-stream/node_modules/@types/node/wasi.d.ts +4 -4
- package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/abortcontroller.d.ts +27 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/blob.d.ts +23 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/console.d.ts +9 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/crypto.d.ts +7 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/events.d.ts +9 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/fetch.d.ts +4 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/performance.d.ts +45 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/streams.d.ts +93 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/timers.d.ts +44 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/url.d.ts +24 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/worker_threads.d.ts +176 -358
- package/node_modules/@types/concat-stream/node_modules/@types/node/zlib.d.ts +8 -71
- package/node_modules/@types/form-data/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/assert/strict.d.ts +5 -11
- package/node_modules/@types/form-data/node_modules/@types/node/assert.d.ts +9 -169
- package/node_modules/@types/form-data/node_modules/@types/node/async_hooks.d.ts +8 -8
- package/node_modules/@types/form-data/node_modules/@types/node/buffer.buffer.d.ts +1 -7
- package/node_modules/@types/form-data/node_modules/@types/node/buffer.d.ts +44 -168
- package/node_modules/@types/form-data/node_modules/@types/node/child_process.d.ts +16 -64
- package/node_modules/@types/form-data/node_modules/@types/node/cluster.d.ts +240 -332
- package/node_modules/@types/form-data/node_modules/@types/node/console.d.ts +49 -351
- package/node_modules/@types/form-data/node_modules/@types/node/constants.d.ts +3 -4
- package/node_modules/@types/form-data/node_modules/@types/node/crypto.d.ts +279 -1631
- package/node_modules/@types/form-data/node_modules/@types/node/dgram.d.ts +15 -51
- package/node_modules/@types/form-data/node_modules/@types/node/diagnostics_channel.d.ts +4 -4
- package/node_modules/@types/form-data/node_modules/@types/node/dns/promises.d.ts +3 -3
- package/node_modules/@types/form-data/node_modules/@types/node/dns.d.ts +131 -132
- package/node_modules/@types/form-data/node_modules/@types/node/domain.d.ts +13 -17
- package/node_modules/@types/form-data/node_modules/@types/node/events.d.ts +869 -791
- package/node_modules/@types/form-data/node_modules/@types/node/fs/promises.d.ts +7 -8
- package/node_modules/@types/form-data/node_modules/@types/node/fs.d.ts +417 -455
- package/node_modules/@types/form-data/node_modules/@types/node/globals.d.ts +6 -26
- package/node_modules/@types/form-data/node_modules/@types/node/globals.typedarray.d.ts +60 -0
- package/node_modules/@types/form-data/node_modules/@types/node/http.d.ts +263 -254
- package/node_modules/@types/form-data/node_modules/@types/node/http2.d.ts +528 -804
- package/node_modules/@types/form-data/node_modules/@types/node/https.d.ts +59 -239
- package/node_modules/@types/form-data/node_modules/@types/node/index.d.ts +15 -1
- package/node_modules/@types/form-data/node_modules/@types/node/inspector/promises.d.ts +41 -0
- package/node_modules/@types/form-data/node_modules/@types/node/inspector.d.ts +6 -59
- package/node_modules/@types/form-data/node_modules/@types/node/inspector.generated.d.ts +3 -10
- package/node_modules/@types/form-data/node_modules/@types/node/module.d.ts +47 -122
- package/node_modules/@types/form-data/node_modules/@types/node/net.d.ts +63 -184
- package/node_modules/@types/form-data/node_modules/@types/node/os.d.ts +6 -6
- package/node_modules/@types/form-data/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/path/posix.d.ts +8 -0
- package/node_modules/@types/form-data/node_modules/@types/node/path/win32.d.ts +8 -0
- package/node_modules/@types/form-data/node_modules/@types/node/path.d.ts +120 -133
- package/node_modules/@types/form-data/node_modules/@types/node/perf_hooks.d.ts +282 -643
- package/node_modules/@types/form-data/node_modules/@types/node/process.d.ts +156 -128
- package/node_modules/@types/form-data/node_modules/@types/node/punycode.d.ts +5 -5
- package/node_modules/@types/form-data/node_modules/@types/node/querystring.d.ts +4 -4
- package/node_modules/@types/form-data/node_modules/@types/node/quic.d.ts +910 -0
- package/node_modules/@types/form-data/node_modules/@types/node/readline/promises.d.ts +3 -3
- package/node_modules/@types/form-data/node_modules/@types/node/readline.d.ts +67 -120
- package/node_modules/@types/form-data/node_modules/@types/node/repl.d.ts +75 -98
- package/node_modules/@types/form-data/node_modules/@types/node/sea.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/sqlite.d.ts +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/stream/consumers.d.ts +10 -10
- package/node_modules/@types/form-data/node_modules/@types/node/stream/promises.d.ts +136 -15
- package/node_modules/@types/form-data/node_modules/@types/node/stream/web.d.ts +176 -453
- package/node_modules/@types/form-data/node_modules/@types/node/stream.d.ts +555 -478
- package/node_modules/@types/form-data/node_modules/@types/node/string_decoder.d.ts +4 -4
- package/node_modules/@types/form-data/node_modules/@types/node/test/reporters.d.ts +96 -0
- package/node_modules/@types/form-data/node_modules/@types/node/test.d.ts +80 -180
- package/node_modules/@types/form-data/node_modules/@types/node/timers/promises.d.ts +4 -4
- package/node_modules/@types/form-data/node_modules/@types/node/timers.d.ts +4 -130
- package/node_modules/@types/form-data/node_modules/@types/node/tls.d.ts +102 -177
- package/node_modules/@types/form-data/node_modules/@types/node/trace_events.d.ts +9 -9
- package/node_modules/@types/form-data/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +1 -7
- package/node_modules/@types/form-data/node_modules/@types/node/ts5.6/index.d.ts +15 -1
- package/node_modules/@types/form-data/node_modules/@types/node/ts5.7/index.d.ts +15 -1
- package/node_modules/@types/form-data/node_modules/@types/node/tty.d.ts +58 -16
- package/node_modules/@types/form-data/node_modules/@types/node/url.d.ts +54 -592
- package/node_modules/@types/form-data/node_modules/@types/node/util/types.d.ts +558 -0
- package/node_modules/@types/form-data/node_modules/@types/node/util.d.ts +120 -792
- package/node_modules/@types/form-data/node_modules/@types/node/v8.d.ts +32 -5
- package/node_modules/@types/form-data/node_modules/@types/node/vm.d.ts +13 -13
- package/node_modules/@types/form-data/node_modules/@types/node/wasi.d.ts +4 -4
- package/node_modules/@types/form-data/node_modules/@types/node/web-globals/abortcontroller.d.ts +27 -2
- package/node_modules/@types/form-data/node_modules/@types/node/web-globals/blob.d.ts +23 -0
- package/node_modules/@types/form-data/node_modules/@types/node/web-globals/console.d.ts +9 -0
- package/node_modules/@types/form-data/node_modules/@types/node/web-globals/crypto.d.ts +7 -0
- package/node_modules/@types/form-data/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
- package/node_modules/@types/form-data/node_modules/@types/node/web-globals/events.d.ts +9 -0
- package/node_modules/@types/form-data/node_modules/@types/node/web-globals/fetch.d.ts +4 -0
- package/node_modules/@types/form-data/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
- package/node_modules/@types/form-data/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
- package/node_modules/@types/form-data/node_modules/@types/node/web-globals/performance.d.ts +45 -0
- package/node_modules/@types/form-data/node_modules/@types/node/web-globals/streams.d.ts +93 -0
- package/node_modules/@types/form-data/node_modules/@types/node/web-globals/timers.d.ts +44 -0
- package/node_modules/@types/form-data/node_modules/@types/node/web-globals/url.d.ts +24 -0
- package/node_modules/@types/form-data/node_modules/@types/node/worker_threads.d.ts +176 -358
- package/node_modules/@types/form-data/node_modules/@types/node/zlib.d.ts +8 -71
- package/package.json +4 -4
|
@@ -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
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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;
|
|
147
|
+
}
|
|
148
|
+
import _inspect = inspect;
|
|
149
|
+
export interface Inspectable {
|
|
150
|
+
[inspect.custom](depth: number, options: InspectContext, inspect: typeof _inspect): any;
|
|
110
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`.
|
|
@@ -609,19 +663,11 @@ declare module "util" {
|
|
|
609
663
|
export function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
|
|
610
664
|
export function inspect(object: any, options?: InspectOptions): string;
|
|
611
665
|
export namespace inspect {
|
|
612
|
-
|
|
613
|
-
let
|
|
614
|
-
|
|
615
|
-
};
|
|
666
|
+
const custom: unique symbol;
|
|
667
|
+
let colors: InspectColors;
|
|
668
|
+
let styles: InspectStyles;
|
|
616
669
|
let defaultOptions: InspectOptions;
|
|
617
|
-
/**
|
|
618
|
-
* Allows changing inspect settings from the repl.
|
|
619
|
-
*/
|
|
620
670
|
let replDefaults: InspectOptions;
|
|
621
|
-
/**
|
|
622
|
-
* That can be used to declare custom inspect functions.
|
|
623
|
-
*/
|
|
624
|
-
const custom: unique symbol;
|
|
625
671
|
}
|
|
626
672
|
/**
|
|
627
673
|
* Alias for [`Array.isArray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray).
|
|
@@ -1045,7 +1091,7 @@ declare module "util" {
|
|
|
1045
1091
|
* ```
|
|
1046
1092
|
*
|
|
1047
1093
|
* If there is an `original[util.promisify.custom]` property present, `promisify`
|
|
1048
|
-
* will return its value, see [Custom promisified functions](https://nodejs.org/docs/latest-
|
|
1094
|
+
* will return its value, see [Custom promisified functions](https://nodejs.org/docs/latest-v25.x/api/util.html#custom-promisified-functions).
|
|
1049
1095
|
*
|
|
1050
1096
|
* `promisify()` assumes that `original` is a function taking a callback as its
|
|
1051
1097
|
* final argument in all cases. If `original` is not a function, `promisify()`
|
|
@@ -1136,61 +1182,6 @@ declare module "util" {
|
|
|
1136
1182
|
* @since v20.12.0
|
|
1137
1183
|
*/
|
|
1138
1184
|
export function parseEnv(content: string): NodeJS.Dict<string>;
|
|
1139
|
-
// https://nodejs.org/docs/latest/api/util.html#foreground-colors
|
|
1140
|
-
type ForegroundColors =
|
|
1141
|
-
| "black"
|
|
1142
|
-
| "blackBright"
|
|
1143
|
-
| "blue"
|
|
1144
|
-
| "blueBright"
|
|
1145
|
-
| "cyan"
|
|
1146
|
-
| "cyanBright"
|
|
1147
|
-
| "gray"
|
|
1148
|
-
| "green"
|
|
1149
|
-
| "greenBright"
|
|
1150
|
-
| "grey"
|
|
1151
|
-
| "magenta"
|
|
1152
|
-
| "magentaBright"
|
|
1153
|
-
| "red"
|
|
1154
|
-
| "redBright"
|
|
1155
|
-
| "white"
|
|
1156
|
-
| "whiteBright"
|
|
1157
|
-
| "yellow"
|
|
1158
|
-
| "yellowBright";
|
|
1159
|
-
// https://nodejs.org/docs/latest/api/util.html#background-colors
|
|
1160
|
-
type BackgroundColors =
|
|
1161
|
-
| "bgBlack"
|
|
1162
|
-
| "bgBlackBright"
|
|
1163
|
-
| "bgBlue"
|
|
1164
|
-
| "bgBlueBright"
|
|
1165
|
-
| "bgCyan"
|
|
1166
|
-
| "bgCyanBright"
|
|
1167
|
-
| "bgGray"
|
|
1168
|
-
| "bgGreen"
|
|
1169
|
-
| "bgGreenBright"
|
|
1170
|
-
| "bgGrey"
|
|
1171
|
-
| "bgMagenta"
|
|
1172
|
-
| "bgMagentaBright"
|
|
1173
|
-
| "bgRed"
|
|
1174
|
-
| "bgRedBright"
|
|
1175
|
-
| "bgWhite"
|
|
1176
|
-
| "bgWhiteBright"
|
|
1177
|
-
| "bgYellow"
|
|
1178
|
-
| "bgYellowBright";
|
|
1179
|
-
// https://nodejs.org/docs/latest/api/util.html#modifiers
|
|
1180
|
-
type Modifiers =
|
|
1181
|
-
| "blink"
|
|
1182
|
-
| "bold"
|
|
1183
|
-
| "dim"
|
|
1184
|
-
| "doubleunderline"
|
|
1185
|
-
| "framed"
|
|
1186
|
-
| "hidden"
|
|
1187
|
-
| "inverse"
|
|
1188
|
-
| "italic"
|
|
1189
|
-
| "none"
|
|
1190
|
-
| "overlined"
|
|
1191
|
-
| "reset"
|
|
1192
|
-
| "strikethrough"
|
|
1193
|
-
| "underline";
|
|
1194
1185
|
export interface StyleTextOptions {
|
|
1195
1186
|
/**
|
|
1196
1187
|
* When true, `stream` is checked to see if it can handle colors.
|
|
@@ -1245,142 +1236,19 @@ declare module "util" {
|
|
|
1245
1236
|
*
|
|
1246
1237
|
* The special format value `none` applies no additional styling to the text.
|
|
1247
1238
|
*
|
|
1248
|
-
* The full list of formats can be found in [modifiers](https://nodejs.org/docs/latest-
|
|
1239
|
+
* The full list of formats can be found in [modifiers](https://nodejs.org/docs/latest-v25.x/api/util.html#modifiers).
|
|
1249
1240
|
* @param format A text format or an Array of text formats defined in `util.inspect.colors`.
|
|
1250
1241
|
* @param text The text to to be formatted.
|
|
1251
1242
|
* @since v20.12.0
|
|
1252
1243
|
*/
|
|
1253
1244
|
export function styleText(
|
|
1254
|
-
format:
|
|
1255
|
-
| ForegroundColors
|
|
1256
|
-
| BackgroundColors
|
|
1257
|
-
| Modifiers
|
|
1258
|
-
| Array<ForegroundColors | BackgroundColors | Modifiers>,
|
|
1245
|
+
format: InspectColor | readonly InspectColor[],
|
|
1259
1246
|
text: string,
|
|
1260
1247
|
options?: StyleTextOptions,
|
|
1261
1248
|
): string;
|
|
1262
|
-
/**
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
* ```js
|
|
1266
|
-
* const decoder = new TextDecoder();
|
|
1267
|
-
* const u8arr = new Uint8Array([72, 101, 108, 108, 111]);
|
|
1268
|
-
* console.log(decoder.decode(u8arr)); // Hello
|
|
1269
|
-
* ```
|
|
1270
|
-
* @since v8.3.0
|
|
1271
|
-
*/
|
|
1272
|
-
export class TextDecoder {
|
|
1273
|
-
/**
|
|
1274
|
-
* The encoding supported by the `TextDecoder` instance.
|
|
1275
|
-
*/
|
|
1276
|
-
readonly encoding: string;
|
|
1277
|
-
/**
|
|
1278
|
-
* The value will be `true` if decoding errors result in a `TypeError` being
|
|
1279
|
-
* thrown.
|
|
1280
|
-
*/
|
|
1281
|
-
readonly fatal: boolean;
|
|
1282
|
-
/**
|
|
1283
|
-
* The value will be `true` if the decoding result will include the byte order
|
|
1284
|
-
* mark.
|
|
1285
|
-
*/
|
|
1286
|
-
readonly ignoreBOM: boolean;
|
|
1287
|
-
constructor(
|
|
1288
|
-
encoding?: string,
|
|
1289
|
-
options?: {
|
|
1290
|
-
fatal?: boolean | undefined;
|
|
1291
|
-
ignoreBOM?: boolean | undefined;
|
|
1292
|
-
},
|
|
1293
|
-
);
|
|
1294
|
-
/**
|
|
1295
|
-
* Decodes the `input` and returns a string. If `options.stream` is `true`, any
|
|
1296
|
-
* incomplete byte sequences occurring at the end of the `input` are buffered
|
|
1297
|
-
* internally and emitted after the next call to `textDecoder.decode()`.
|
|
1298
|
-
*
|
|
1299
|
-
* If `textDecoder.fatal` is `true`, decoding errors that occur will result in a `TypeError` being thrown.
|
|
1300
|
-
* @param input An `ArrayBuffer`, `DataView`, or `TypedArray` instance containing the encoded data.
|
|
1301
|
-
*/
|
|
1302
|
-
decode(
|
|
1303
|
-
input?: NodeJS.ArrayBufferView | ArrayBuffer | null,
|
|
1304
|
-
options?: {
|
|
1305
|
-
stream?: boolean | undefined;
|
|
1306
|
-
},
|
|
1307
|
-
): string;
|
|
1308
|
-
}
|
|
1309
|
-
export interface EncodeIntoResult {
|
|
1310
|
-
/**
|
|
1311
|
-
* The read Unicode code units of input.
|
|
1312
|
-
*/
|
|
1313
|
-
read: number;
|
|
1314
|
-
/**
|
|
1315
|
-
* The written UTF-8 bytes of output.
|
|
1316
|
-
*/
|
|
1317
|
-
written: number;
|
|
1318
|
-
}
|
|
1319
|
-
export { types };
|
|
1320
|
-
|
|
1321
|
-
//// TextEncoder/Decoder
|
|
1322
|
-
/**
|
|
1323
|
-
* An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextEncoder` API. All
|
|
1324
|
-
* instances of `TextEncoder` only support UTF-8 encoding.
|
|
1325
|
-
*
|
|
1326
|
-
* ```js
|
|
1327
|
-
* const encoder = new TextEncoder();
|
|
1328
|
-
* const uint8array = encoder.encode('this is some data');
|
|
1329
|
-
* ```
|
|
1330
|
-
*
|
|
1331
|
-
* The `TextEncoder` class is also available on the global object.
|
|
1332
|
-
* @since v8.3.0
|
|
1333
|
-
*/
|
|
1334
|
-
export class TextEncoder {
|
|
1335
|
-
/**
|
|
1336
|
-
* The encoding supported by the `TextEncoder` instance. Always set to `'utf-8'`.
|
|
1337
|
-
*/
|
|
1338
|
-
readonly encoding: string;
|
|
1339
|
-
/**
|
|
1340
|
-
* UTF-8 encodes the `input` string and returns a `Uint8Array` containing the
|
|
1341
|
-
* encoded bytes.
|
|
1342
|
-
* @param [input='an empty string'] The text to encode.
|
|
1343
|
-
*/
|
|
1344
|
-
encode(input?: string): NodeJS.NonSharedUint8Array;
|
|
1345
|
-
/**
|
|
1346
|
-
* UTF-8 encodes the `src` string to the `dest` Uint8Array and returns an object
|
|
1347
|
-
* containing the read Unicode code units and written UTF-8 bytes.
|
|
1348
|
-
*
|
|
1349
|
-
* ```js
|
|
1350
|
-
* const encoder = new TextEncoder();
|
|
1351
|
-
* const src = 'this is some data';
|
|
1352
|
-
* const dest = new Uint8Array(10);
|
|
1353
|
-
* const { read, written } = encoder.encodeInto(src, dest);
|
|
1354
|
-
* ```
|
|
1355
|
-
* @param src The text to encode.
|
|
1356
|
-
* @param dest The array to hold the encode result.
|
|
1357
|
-
*/
|
|
1358
|
-
encodeInto(src: string, dest: Uint8Array): EncodeIntoResult;
|
|
1359
|
-
}
|
|
1360
|
-
import { TextDecoder as _TextDecoder, TextEncoder as _TextEncoder } from "util";
|
|
1361
|
-
global {
|
|
1362
|
-
/**
|
|
1363
|
-
* `TextDecoder` class is a global reference for `import { TextDecoder } from 'node:util'`
|
|
1364
|
-
* https://nodejs.org/api/globals.html#textdecoder
|
|
1365
|
-
* @since v11.0.0
|
|
1366
|
-
*/
|
|
1367
|
-
var TextDecoder: typeof globalThis extends {
|
|
1368
|
-
onmessage: any;
|
|
1369
|
-
TextDecoder: infer TextDecoder;
|
|
1370
|
-
} ? TextDecoder
|
|
1371
|
-
: typeof _TextDecoder;
|
|
1372
|
-
/**
|
|
1373
|
-
* `TextEncoder` class is a global reference for `import { TextEncoder } from 'node:util'`
|
|
1374
|
-
* https://nodejs.org/api/globals.html#textencoder
|
|
1375
|
-
* @since v11.0.0
|
|
1376
|
-
*/
|
|
1377
|
-
var TextEncoder: typeof globalThis extends {
|
|
1378
|
-
onmessage: any;
|
|
1379
|
-
TextEncoder: infer TextEncoder;
|
|
1380
|
-
} ? TextEncoder
|
|
1381
|
-
: typeof _TextEncoder;
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1249
|
+
/** @deprecated This alias will be removed in a future version. Use the canonical `TextEncoderEncodeIntoResult` instead. */
|
|
1250
|
+
// TODO: remove in future major
|
|
1251
|
+
export interface EncodeIntoResult extends TextEncoderEncodeIntoResult {}
|
|
1384
1252
|
//// parseArgs
|
|
1385
1253
|
/**
|
|
1386
1254
|
* Provides a higher level API for command-line argument parsing than interacting
|
|
@@ -1411,12 +1279,10 @@ declare module "util" {
|
|
|
1411
1279
|
* @return The parsed command line arguments:
|
|
1412
1280
|
*/
|
|
1413
1281
|
export function parseArgs<T extends ParseArgsConfig>(config?: T): ParsedResults<T>;
|
|
1414
|
-
|
|
1415
1282
|
/**
|
|
1416
1283
|
* Type of argument used in {@link parseArgs}.
|
|
1417
1284
|
*/
|
|
1418
1285
|
export type ParseArgsOptionsType = "boolean" | "string";
|
|
1419
|
-
|
|
1420
1286
|
export interface ParseArgsOptionDescriptor {
|
|
1421
1287
|
/**
|
|
1422
1288
|
* Type of argument.
|
|
@@ -1491,23 +1357,19 @@ declare module "util" {
|
|
|
1491
1357
|
type IfDefaultsTrue<T, IfTrue, IfFalse> = T extends true ? IfTrue
|
|
1492
1358
|
: T extends false ? IfFalse
|
|
1493
1359
|
: IfTrue;
|
|
1494
|
-
|
|
1495
1360
|
// we put the `extends false` condition first here because `undefined` compares like `any` when `strictNullChecks: false`
|
|
1496
1361
|
type IfDefaultsFalse<T, IfTrue, IfFalse> = T extends false ? IfFalse
|
|
1497
1362
|
: T extends true ? IfTrue
|
|
1498
1363
|
: IfFalse;
|
|
1499
|
-
|
|
1500
1364
|
type ExtractOptionValue<T extends ParseArgsConfig, O extends ParseArgsOptionDescriptor> = IfDefaultsTrue<
|
|
1501
1365
|
T["strict"],
|
|
1502
1366
|
O["type"] extends "string" ? string : O["type"] extends "boolean" ? boolean : string | boolean,
|
|
1503
1367
|
string | boolean
|
|
1504
1368
|
>;
|
|
1505
|
-
|
|
1506
1369
|
type ApplyOptionalModifiers<O extends ParseArgsOptionsConfig, V extends Record<keyof O, unknown>> = (
|
|
1507
1370
|
& { -readonly [LongOption in keyof O]?: V[LongOption] }
|
|
1508
1371
|
& { [LongOption in keyof O as O[LongOption]["default"] extends {} ? LongOption : never]: V[LongOption] }
|
|
1509
1372
|
) extends infer P ? { [K in keyof P]: P[K] } : never; // resolve intersection to object
|
|
1510
|
-
|
|
1511
1373
|
type ParsedValues<T extends ParseArgsConfig> =
|
|
1512
1374
|
& IfDefaultsTrue<T["strict"], unknown, { [longOption: string]: undefined | string | boolean }>
|
|
1513
1375
|
& (T["options"] extends ParseArgsOptionsConfig ? ApplyOptionalModifiers<
|
|
@@ -1521,13 +1383,11 @@ declare module "util" {
|
|
|
1521
1383
|
}
|
|
1522
1384
|
>
|
|
1523
1385
|
: {});
|
|
1524
|
-
|
|
1525
1386
|
type ParsedPositionals<T extends ParseArgsConfig> = IfDefaultsTrue<
|
|
1526
1387
|
T["strict"],
|
|
1527
1388
|
IfDefaultsFalse<T["allowPositionals"], string[], []>,
|
|
1528
1389
|
IfDefaultsTrue<T["allowPositionals"], string[], []>
|
|
1529
1390
|
>;
|
|
1530
|
-
|
|
1531
1391
|
type PreciseTokenForOptions<
|
|
1532
1392
|
K extends string,
|
|
1533
1393
|
O extends ParseArgsOptionDescriptor,
|
|
@@ -1548,7 +1408,6 @@ declare module "util" {
|
|
|
1548
1408
|
inlineValue: undefined;
|
|
1549
1409
|
}
|
|
1550
1410
|
: OptionToken & { name: K };
|
|
1551
|
-
|
|
1552
1411
|
type TokenForOptions<
|
|
1553
1412
|
T extends ParseArgsConfig,
|
|
1554
1413
|
K extends keyof T["options"] = keyof T["options"],
|
|
@@ -1556,19 +1415,15 @@ declare module "util" {
|
|
|
1556
1415
|
? T["options"] extends ParseArgsOptionsConfig ? PreciseTokenForOptions<K & string, T["options"][K]>
|
|
1557
1416
|
: OptionToken
|
|
1558
1417
|
: never;
|
|
1559
|
-
|
|
1560
1418
|
type ParsedOptionToken<T extends ParseArgsConfig> = IfDefaultsTrue<T["strict"], TokenForOptions<T>, OptionToken>;
|
|
1561
|
-
|
|
1562
1419
|
type ParsedPositionalToken<T extends ParseArgsConfig> = IfDefaultsTrue<
|
|
1563
1420
|
T["strict"],
|
|
1564
1421
|
IfDefaultsFalse<T["allowPositionals"], { kind: "positional"; index: number; value: string }, never>,
|
|
1565
1422
|
IfDefaultsTrue<T["allowPositionals"], { kind: "positional"; index: number; value: string }, never>
|
|
1566
1423
|
>;
|
|
1567
|
-
|
|
1568
1424
|
type ParsedTokens<T extends ParseArgsConfig> = Array<
|
|
1569
1425
|
ParsedOptionToken<T> | ParsedPositionalToken<T> | { kind: "option-terminator"; index: number }
|
|
1570
1426
|
>;
|
|
1571
|
-
|
|
1572
1427
|
type PreciseParsedResults<T extends ParseArgsConfig> = IfDefaultsFalse<
|
|
1573
1428
|
T["tokens"],
|
|
1574
1429
|
{
|
|
@@ -1581,7 +1436,6 @@ declare module "util" {
|
|
|
1581
1436
|
positionals: ParsedPositionals<T>;
|
|
1582
1437
|
}
|
|
1583
1438
|
>;
|
|
1584
|
-
|
|
1585
1439
|
type OptionToken =
|
|
1586
1440
|
| { kind: "option"; index: number; name: string; rawName: string; value: string; inlineValue: boolean }
|
|
1587
1441
|
| {
|
|
@@ -1592,12 +1446,10 @@ declare module "util" {
|
|
|
1592
1446
|
value: undefined;
|
|
1593
1447
|
inlineValue: undefined;
|
|
1594
1448
|
};
|
|
1595
|
-
|
|
1596
1449
|
type Token =
|
|
1597
1450
|
| OptionToken
|
|
1598
1451
|
| { kind: "positional"; index: number; value: string }
|
|
1599
1452
|
| { kind: "option-terminator"; index: number };
|
|
1600
|
-
|
|
1601
1453
|
// If ParseArgsConfig extends T, then the user passed config constructed elsewhere.
|
|
1602
1454
|
// So we can't rely on the `"not definitely present" implies "definitely not present"` assumption mentioned above.
|
|
1603
1455
|
type ParsedResults<T extends ParseArgsConfig> = ParseArgsConfig extends T ? {
|
|
@@ -1608,7 +1460,6 @@ declare module "util" {
|
|
|
1608
1460
|
tokens?: Token[];
|
|
1609
1461
|
}
|
|
1610
1462
|
: PreciseParsedResults<T>;
|
|
1611
|
-
|
|
1612
1463
|
/**
|
|
1613
1464
|
* An implementation of [the MIMEType class](https://bmeck.github.io/node-proposal-mime-api/).
|
|
1614
1465
|
*
|
|
@@ -1630,7 +1481,6 @@ declare module "util" {
|
|
|
1630
1481
|
* @param input The input MIME to parse.
|
|
1631
1482
|
*/
|
|
1632
1483
|
constructor(input: string | { toString: () => string });
|
|
1633
|
-
|
|
1634
1484
|
/**
|
|
1635
1485
|
* Gets and sets the type portion of the MIME.
|
|
1636
1486
|
*
|
|
@@ -1761,565 +1611,43 @@ declare module "util" {
|
|
|
1761
1611
|
*/
|
|
1762
1612
|
[Symbol.iterator](): NodeJS.Iterator<[name: string, value: string]>;
|
|
1763
1613
|
}
|
|
1614
|
+
// #region web types
|
|
1615
|
+
export interface TextDecodeOptions {
|
|
1616
|
+
stream?: boolean;
|
|
1617
|
+
}
|
|
1618
|
+
export interface TextDecoderCommon {
|
|
1619
|
+
readonly encoding: string;
|
|
1620
|
+
readonly fatal: boolean;
|
|
1621
|
+
readonly ignoreBOM: boolean;
|
|
1622
|
+
}
|
|
1623
|
+
export interface TextDecoderOptions {
|
|
1624
|
+
fatal?: boolean;
|
|
1625
|
+
ignoreBOM?: boolean;
|
|
1626
|
+
}
|
|
1627
|
+
export interface TextEncoderCommon {
|
|
1628
|
+
readonly encoding: string;
|
|
1629
|
+
}
|
|
1630
|
+
export interface TextEncoderEncodeIntoResult {
|
|
1631
|
+
read: number;
|
|
1632
|
+
written: number;
|
|
1633
|
+
}
|
|
1634
|
+
export interface TextDecoder extends TextDecoderCommon {
|
|
1635
|
+
decode(input?: NodeJS.AllowSharedBufferSource, options?: TextDecodeOptions): string;
|
|
1636
|
+
}
|
|
1637
|
+
export var TextDecoder: {
|
|
1638
|
+
prototype: TextDecoder;
|
|
1639
|
+
new(label?: string, options?: TextDecoderOptions): TextDecoder;
|
|
1640
|
+
};
|
|
1641
|
+
export interface TextEncoder extends TextEncoderCommon {
|
|
1642
|
+
encode(input?: string): NodeJS.NonSharedUint8Array;
|
|
1643
|
+
encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult;
|
|
1644
|
+
}
|
|
1645
|
+
export var TextEncoder: {
|
|
1646
|
+
prototype: TextEncoder;
|
|
1647
|
+
new(): TextEncoder;
|
|
1648
|
+
};
|
|
1649
|
+
// #endregion
|
|
1764
1650
|
}
|
|
1765
|
-
declare module "util
|
|
1766
|
-
|
|
1767
|
-
/**
|
|
1768
|
-
* Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) or
|
|
1769
|
-
* [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance.
|
|
1770
|
-
*
|
|
1771
|
-
* See also `util.types.isArrayBuffer()` and `util.types.isSharedArrayBuffer()`.
|
|
1772
|
-
*
|
|
1773
|
-
* ```js
|
|
1774
|
-
* util.types.isAnyArrayBuffer(new ArrayBuffer()); // Returns true
|
|
1775
|
-
* util.types.isAnyArrayBuffer(new SharedArrayBuffer()); // Returns true
|
|
1776
|
-
* ```
|
|
1777
|
-
* @since v10.0.0
|
|
1778
|
-
*/
|
|
1779
|
-
function isAnyArrayBuffer(object: unknown): object is ArrayBufferLike;
|
|
1780
|
-
/**
|
|
1781
|
-
* Returns `true` if the value is an `arguments` object.
|
|
1782
|
-
*
|
|
1783
|
-
* ```js
|
|
1784
|
-
* function foo() {
|
|
1785
|
-
* util.types.isArgumentsObject(arguments); // Returns true
|
|
1786
|
-
* }
|
|
1787
|
-
* ```
|
|
1788
|
-
* @since v10.0.0
|
|
1789
|
-
*/
|
|
1790
|
-
function isArgumentsObject(object: unknown): object is IArguments;
|
|
1791
|
-
/**
|
|
1792
|
-
* Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instance.
|
|
1793
|
-
* This does _not_ include [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instances. Usually, it is
|
|
1794
|
-
* desirable to test for both; See `util.types.isAnyArrayBuffer()` for that.
|
|
1795
|
-
*
|
|
1796
|
-
* ```js
|
|
1797
|
-
* util.types.isArrayBuffer(new ArrayBuffer()); // Returns true
|
|
1798
|
-
* util.types.isArrayBuffer(new SharedArrayBuffer()); // Returns false
|
|
1799
|
-
* ```
|
|
1800
|
-
* @since v10.0.0
|
|
1801
|
-
*/
|
|
1802
|
-
function isArrayBuffer(object: unknown): object is ArrayBuffer;
|
|
1803
|
-
/**
|
|
1804
|
-
* 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
|
|
1805
|
-
* array objects or [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView). Equivalent to
|
|
1806
|
-
* [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
|
|
1807
|
-
*
|
|
1808
|
-
* ```js
|
|
1809
|
-
* util.types.isArrayBufferView(new Int8Array()); // true
|
|
1810
|
-
* util.types.isArrayBufferView(Buffer.from('hello world')); // true
|
|
1811
|
-
* util.types.isArrayBufferView(new DataView(new ArrayBuffer(16))); // true
|
|
1812
|
-
* util.types.isArrayBufferView(new ArrayBuffer()); // false
|
|
1813
|
-
* ```
|
|
1814
|
-
* @since v10.0.0
|
|
1815
|
-
*/
|
|
1816
|
-
function isArrayBufferView(object: unknown): object is NodeJS.ArrayBufferView;
|
|
1817
|
-
/**
|
|
1818
|
-
* Returns `true` if the value is an [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function).
|
|
1819
|
-
* This only reports back what the JavaScript engine is seeing;
|
|
1820
|
-
* in particular, the return value may not match the original source code if
|
|
1821
|
-
* a transpilation tool was used.
|
|
1822
|
-
*
|
|
1823
|
-
* ```js
|
|
1824
|
-
* util.types.isAsyncFunction(function foo() {}); // Returns false
|
|
1825
|
-
* util.types.isAsyncFunction(async function foo() {}); // Returns true
|
|
1826
|
-
* ```
|
|
1827
|
-
* @since v10.0.0
|
|
1828
|
-
*/
|
|
1829
|
-
function isAsyncFunction(object: unknown): boolean;
|
|
1830
|
-
/**
|
|
1831
|
-
* Returns `true` if the value is a `BigInt64Array` instance.
|
|
1832
|
-
*
|
|
1833
|
-
* ```js
|
|
1834
|
-
* util.types.isBigInt64Array(new BigInt64Array()); // Returns true
|
|
1835
|
-
* util.types.isBigInt64Array(new BigUint64Array()); // Returns false
|
|
1836
|
-
* ```
|
|
1837
|
-
* @since v10.0.0
|
|
1838
|
-
*/
|
|
1839
|
-
function isBigInt64Array(value: unknown): value is BigInt64Array;
|
|
1840
|
-
/**
|
|
1841
|
-
* Returns `true` if the value is a BigInt object, e.g. created
|
|
1842
|
-
* by `Object(BigInt(123))`.
|
|
1843
|
-
*
|
|
1844
|
-
* ```js
|
|
1845
|
-
* util.types.isBigIntObject(Object(BigInt(123))); // Returns true
|
|
1846
|
-
* util.types.isBigIntObject(BigInt(123)); // Returns false
|
|
1847
|
-
* util.types.isBigIntObject(123); // Returns false
|
|
1848
|
-
* ```
|
|
1849
|
-
* @since v10.4.0
|
|
1850
|
-
*/
|
|
1851
|
-
function isBigIntObject(object: unknown): object is BigInt;
|
|
1852
|
-
/**
|
|
1853
|
-
* Returns `true` if the value is a `BigUint64Array` instance.
|
|
1854
|
-
*
|
|
1855
|
-
* ```js
|
|
1856
|
-
* util.types.isBigUint64Array(new BigInt64Array()); // Returns false
|
|
1857
|
-
* util.types.isBigUint64Array(new BigUint64Array()); // Returns true
|
|
1858
|
-
* ```
|
|
1859
|
-
* @since v10.0.0
|
|
1860
|
-
*/
|
|
1861
|
-
function isBigUint64Array(value: unknown): value is BigUint64Array;
|
|
1862
|
-
/**
|
|
1863
|
-
* Returns `true` if the value is a boolean object, e.g. created
|
|
1864
|
-
* by `new Boolean()`.
|
|
1865
|
-
*
|
|
1866
|
-
* ```js
|
|
1867
|
-
* util.types.isBooleanObject(false); // Returns false
|
|
1868
|
-
* util.types.isBooleanObject(true); // Returns false
|
|
1869
|
-
* util.types.isBooleanObject(new Boolean(false)); // Returns true
|
|
1870
|
-
* util.types.isBooleanObject(new Boolean(true)); // Returns true
|
|
1871
|
-
* util.types.isBooleanObject(Boolean(false)); // Returns false
|
|
1872
|
-
* util.types.isBooleanObject(Boolean(true)); // Returns false
|
|
1873
|
-
* ```
|
|
1874
|
-
* @since v10.0.0
|
|
1875
|
-
*/
|
|
1876
|
-
function isBooleanObject(object: unknown): object is Boolean;
|
|
1877
|
-
/**
|
|
1878
|
-
* Returns `true` if the value is any boxed primitive object, e.g. created
|
|
1879
|
-
* by `new Boolean()`, `new String()` or `Object(Symbol())`.
|
|
1880
|
-
*
|
|
1881
|
-
* For example:
|
|
1882
|
-
*
|
|
1883
|
-
* ```js
|
|
1884
|
-
* util.types.isBoxedPrimitive(false); // Returns false
|
|
1885
|
-
* util.types.isBoxedPrimitive(new Boolean(false)); // Returns true
|
|
1886
|
-
* util.types.isBoxedPrimitive(Symbol('foo')); // Returns false
|
|
1887
|
-
* util.types.isBoxedPrimitive(Object(Symbol('foo'))); // Returns true
|
|
1888
|
-
* util.types.isBoxedPrimitive(Object(BigInt(5))); // Returns true
|
|
1889
|
-
* ```
|
|
1890
|
-
* @since v10.11.0
|
|
1891
|
-
*/
|
|
1892
|
-
function isBoxedPrimitive(object: unknown): object is String | Number | BigInt | Boolean | Symbol;
|
|
1893
|
-
/**
|
|
1894
|
-
* Returns `true` if the value is a built-in [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) instance.
|
|
1895
|
-
*
|
|
1896
|
-
* ```js
|
|
1897
|
-
* const ab = new ArrayBuffer(20);
|
|
1898
|
-
* util.types.isDataView(new DataView(ab)); // Returns true
|
|
1899
|
-
* util.types.isDataView(new Float64Array()); // Returns false
|
|
1900
|
-
* ```
|
|
1901
|
-
*
|
|
1902
|
-
* See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
|
|
1903
|
-
* @since v10.0.0
|
|
1904
|
-
*/
|
|
1905
|
-
function isDataView(object: unknown): object is DataView;
|
|
1906
|
-
/**
|
|
1907
|
-
* Returns `true` if the value is a built-in [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) instance.
|
|
1908
|
-
*
|
|
1909
|
-
* ```js
|
|
1910
|
-
* util.types.isDate(new Date()); // Returns true
|
|
1911
|
-
* ```
|
|
1912
|
-
* @since v10.0.0
|
|
1913
|
-
*/
|
|
1914
|
-
function isDate(object: unknown): object is Date;
|
|
1915
|
-
/**
|
|
1916
|
-
* Returns `true` if the value is a native `External` value.
|
|
1917
|
-
*
|
|
1918
|
-
* A native `External` value is a special type of object that contains a
|
|
1919
|
-
* raw C++ pointer (`void*`) for access from native code, and has no other
|
|
1920
|
-
* properties. Such objects are created either by Node.js internals or native
|
|
1921
|
-
* addons. In JavaScript, they are
|
|
1922
|
-
* [frozen](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze) objects with a
|
|
1923
|
-
* `null` prototype.
|
|
1924
|
-
*
|
|
1925
|
-
* ```c
|
|
1926
|
-
* #include <js_native_api.h>
|
|
1927
|
-
* #include <stdlib.h>
|
|
1928
|
-
* napi_value result;
|
|
1929
|
-
* static napi_value MyNapi(napi_env env, napi_callback_info info) {
|
|
1930
|
-
* int* raw = (int*) malloc(1024);
|
|
1931
|
-
* napi_status status = napi_create_external(env, (void*) raw, NULL, NULL, &result);
|
|
1932
|
-
* if (status != napi_ok) {
|
|
1933
|
-
* napi_throw_error(env, NULL, "napi_create_external failed");
|
|
1934
|
-
* return NULL;
|
|
1935
|
-
* }
|
|
1936
|
-
* return result;
|
|
1937
|
-
* }
|
|
1938
|
-
* ...
|
|
1939
|
-
* DECLARE_NAPI_PROPERTY("myNapi", MyNapi)
|
|
1940
|
-
* ...
|
|
1941
|
-
* ```
|
|
1942
|
-
*
|
|
1943
|
-
* ```js
|
|
1944
|
-
* import native from 'napi_addon.node';
|
|
1945
|
-
* import { types } from 'node:util';
|
|
1946
|
-
*
|
|
1947
|
-
* const data = native.myNapi();
|
|
1948
|
-
* types.isExternal(data); // returns true
|
|
1949
|
-
* types.isExternal(0); // returns false
|
|
1950
|
-
* types.isExternal(new String('foo')); // returns false
|
|
1951
|
-
* ```
|
|
1952
|
-
*
|
|
1953
|
-
* For further information on `napi_create_external`, refer to
|
|
1954
|
-
* [`napi_create_external()`](https://nodejs.org/docs/latest-v24.x/api/n-api.html#napi_create_external).
|
|
1955
|
-
* @since v10.0.0
|
|
1956
|
-
*/
|
|
1957
|
-
function isExternal(object: unknown): boolean;
|
|
1958
|
-
/**
|
|
1959
|
-
* Returns `true` if the value is a built-in [`Float16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float16Array) instance.
|
|
1960
|
-
*
|
|
1961
|
-
* ```js
|
|
1962
|
-
* util.types.isFloat16Array(new ArrayBuffer()); // Returns false
|
|
1963
|
-
* util.types.isFloat16Array(new Float16Array()); // Returns true
|
|
1964
|
-
* util.types.isFloat16Array(new Float32Array()); // Returns false
|
|
1965
|
-
* ```
|
|
1966
|
-
* @since v24.0.0
|
|
1967
|
-
*/
|
|
1968
|
-
function isFloat16Array(object: unknown): object is Float16Array;
|
|
1969
|
-
/**
|
|
1970
|
-
* Returns `true` if the value is a built-in [`Float32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array) instance.
|
|
1971
|
-
*
|
|
1972
|
-
* ```js
|
|
1973
|
-
* util.types.isFloat32Array(new ArrayBuffer()); // Returns false
|
|
1974
|
-
* util.types.isFloat32Array(new Float32Array()); // Returns true
|
|
1975
|
-
* util.types.isFloat32Array(new Float64Array()); // Returns false
|
|
1976
|
-
* ```
|
|
1977
|
-
* @since v10.0.0
|
|
1978
|
-
*/
|
|
1979
|
-
function isFloat32Array(object: unknown): object is Float32Array;
|
|
1980
|
-
/**
|
|
1981
|
-
* Returns `true` if the value is a built-in [`Float64Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array) instance.
|
|
1982
|
-
*
|
|
1983
|
-
* ```js
|
|
1984
|
-
* util.types.isFloat64Array(new ArrayBuffer()); // Returns false
|
|
1985
|
-
* util.types.isFloat64Array(new Uint8Array()); // Returns false
|
|
1986
|
-
* util.types.isFloat64Array(new Float64Array()); // Returns true
|
|
1987
|
-
* ```
|
|
1988
|
-
* @since v10.0.0
|
|
1989
|
-
*/
|
|
1990
|
-
function isFloat64Array(object: unknown): object is Float64Array;
|
|
1991
|
-
/**
|
|
1992
|
-
* Returns `true` if the value is a generator function.
|
|
1993
|
-
* This only reports back what the JavaScript engine is seeing;
|
|
1994
|
-
* in particular, the return value may not match the original source code if
|
|
1995
|
-
* a transpilation tool was used.
|
|
1996
|
-
*
|
|
1997
|
-
* ```js
|
|
1998
|
-
* util.types.isGeneratorFunction(function foo() {}); // Returns false
|
|
1999
|
-
* util.types.isGeneratorFunction(function* foo() {}); // Returns true
|
|
2000
|
-
* ```
|
|
2001
|
-
* @since v10.0.0
|
|
2002
|
-
*/
|
|
2003
|
-
function isGeneratorFunction(object: unknown): object is GeneratorFunction;
|
|
2004
|
-
/**
|
|
2005
|
-
* Returns `true` if the value is a generator object as returned from a
|
|
2006
|
-
* built-in generator function.
|
|
2007
|
-
* This only reports back what the JavaScript engine is seeing;
|
|
2008
|
-
* in particular, the return value may not match the original source code if
|
|
2009
|
-
* a transpilation tool was used.
|
|
2010
|
-
*
|
|
2011
|
-
* ```js
|
|
2012
|
-
* function* foo() {}
|
|
2013
|
-
* const generator = foo();
|
|
2014
|
-
* util.types.isGeneratorObject(generator); // Returns true
|
|
2015
|
-
* ```
|
|
2016
|
-
* @since v10.0.0
|
|
2017
|
-
*/
|
|
2018
|
-
function isGeneratorObject(object: unknown): object is Generator;
|
|
2019
|
-
/**
|
|
2020
|
-
* Returns `true` if the value is a built-in [`Int8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array) instance.
|
|
2021
|
-
*
|
|
2022
|
-
* ```js
|
|
2023
|
-
* util.types.isInt8Array(new ArrayBuffer()); // Returns false
|
|
2024
|
-
* util.types.isInt8Array(new Int8Array()); // Returns true
|
|
2025
|
-
* util.types.isInt8Array(new Float64Array()); // Returns false
|
|
2026
|
-
* ```
|
|
2027
|
-
* @since v10.0.0
|
|
2028
|
-
*/
|
|
2029
|
-
function isInt8Array(object: unknown): object is Int8Array;
|
|
2030
|
-
/**
|
|
2031
|
-
* Returns `true` if the value is a built-in [`Int16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array) instance.
|
|
2032
|
-
*
|
|
2033
|
-
* ```js
|
|
2034
|
-
* util.types.isInt16Array(new ArrayBuffer()); // Returns false
|
|
2035
|
-
* util.types.isInt16Array(new Int16Array()); // Returns true
|
|
2036
|
-
* util.types.isInt16Array(new Float64Array()); // Returns false
|
|
2037
|
-
* ```
|
|
2038
|
-
* @since v10.0.0
|
|
2039
|
-
*/
|
|
2040
|
-
function isInt16Array(object: unknown): object is Int16Array;
|
|
2041
|
-
/**
|
|
2042
|
-
* Returns `true` if the value is a built-in [`Int32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array) instance.
|
|
2043
|
-
*
|
|
2044
|
-
* ```js
|
|
2045
|
-
* util.types.isInt32Array(new ArrayBuffer()); // Returns false
|
|
2046
|
-
* util.types.isInt32Array(new Int32Array()); // Returns true
|
|
2047
|
-
* util.types.isInt32Array(new Float64Array()); // Returns false
|
|
2048
|
-
* ```
|
|
2049
|
-
* @since v10.0.0
|
|
2050
|
-
*/
|
|
2051
|
-
function isInt32Array(object: unknown): object is Int32Array;
|
|
2052
|
-
/**
|
|
2053
|
-
* Returns `true` if the value is a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance.
|
|
2054
|
-
*
|
|
2055
|
-
* ```js
|
|
2056
|
-
* util.types.isMap(new Map()); // Returns true
|
|
2057
|
-
* ```
|
|
2058
|
-
* @since v10.0.0
|
|
2059
|
-
*/
|
|
2060
|
-
function isMap<T>(
|
|
2061
|
-
object: T | {},
|
|
2062
|
-
): object is T extends ReadonlyMap<any, any> ? (unknown extends T ? never : ReadonlyMap<any, any>)
|
|
2063
|
-
: Map<unknown, unknown>;
|
|
2064
|
-
/**
|
|
2065
|
-
* 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.
|
|
2066
|
-
*
|
|
2067
|
-
* ```js
|
|
2068
|
-
* const map = new Map();
|
|
2069
|
-
* util.types.isMapIterator(map.keys()); // Returns true
|
|
2070
|
-
* util.types.isMapIterator(map.values()); // Returns true
|
|
2071
|
-
* util.types.isMapIterator(map.entries()); // Returns true
|
|
2072
|
-
* util.types.isMapIterator(map[Symbol.iterator]()); // Returns true
|
|
2073
|
-
* ```
|
|
2074
|
-
* @since v10.0.0
|
|
2075
|
-
*/
|
|
2076
|
-
function isMapIterator(object: unknown): boolean;
|
|
2077
|
-
/**
|
|
2078
|
-
* Returns `true` if the value is an instance of a [Module Namespace Object](https://tc39.github.io/ecma262/#sec-module-namespace-exotic-objects).
|
|
2079
|
-
*
|
|
2080
|
-
* ```js
|
|
2081
|
-
* import * as ns from './a.js';
|
|
2082
|
-
*
|
|
2083
|
-
* util.types.isModuleNamespaceObject(ns); // Returns true
|
|
2084
|
-
* ```
|
|
2085
|
-
* @since v10.0.0
|
|
2086
|
-
*/
|
|
2087
|
-
function isModuleNamespaceObject(value: unknown): boolean;
|
|
2088
|
-
/**
|
|
2089
|
-
* Returns `true` if the value was returned by the constructor of a
|
|
2090
|
-
* [built-in `Error` type](https://tc39.es/ecma262/#sec-error-objects).
|
|
2091
|
-
*
|
|
2092
|
-
* ```js
|
|
2093
|
-
* console.log(util.types.isNativeError(new Error())); // true
|
|
2094
|
-
* console.log(util.types.isNativeError(new TypeError())); // true
|
|
2095
|
-
* console.log(util.types.isNativeError(new RangeError())); // true
|
|
2096
|
-
* ```
|
|
2097
|
-
*
|
|
2098
|
-
* Subclasses of the native error types are also native errors:
|
|
2099
|
-
*
|
|
2100
|
-
* ```js
|
|
2101
|
-
* class MyError extends Error {}
|
|
2102
|
-
* console.log(util.types.isNativeError(new MyError())); // true
|
|
2103
|
-
* ```
|
|
2104
|
-
*
|
|
2105
|
-
* A value being `instanceof` a native error class is not equivalent to `isNativeError()`
|
|
2106
|
-
* returning `true` for that value. `isNativeError()` returns `true` for errors
|
|
2107
|
-
* which come from a different [realm](https://tc39.es/ecma262/#realm) while `instanceof Error` returns `false`
|
|
2108
|
-
* for these errors:
|
|
2109
|
-
*
|
|
2110
|
-
* ```js
|
|
2111
|
-
* import { createContext, runInContext } from 'node:vm';
|
|
2112
|
-
* import { types } from 'node:util';
|
|
2113
|
-
*
|
|
2114
|
-
* const context = createContext({});
|
|
2115
|
-
* const myError = runInContext('new Error()', context);
|
|
2116
|
-
* console.log(types.isNativeError(myError)); // true
|
|
2117
|
-
* console.log(myError instanceof Error); // false
|
|
2118
|
-
* ```
|
|
2119
|
-
*
|
|
2120
|
-
* Conversely, `isNativeError()` returns `false` for all objects which were not
|
|
2121
|
-
* returned by the constructor of a native error. That includes values
|
|
2122
|
-
* which are `instanceof` native errors:
|
|
2123
|
-
*
|
|
2124
|
-
* ```js
|
|
2125
|
-
* const myError = { __proto__: Error.prototype };
|
|
2126
|
-
* console.log(util.types.isNativeError(myError)); // false
|
|
2127
|
-
* console.log(myError instanceof Error); // true
|
|
2128
|
-
* ```
|
|
2129
|
-
* @since v10.0.0
|
|
2130
|
-
* @deprecated The `util.types.isNativeError` API is deprecated. Please use `Error.isError` instead.
|
|
2131
|
-
*/
|
|
2132
|
-
function isNativeError(object: unknown): object is Error;
|
|
2133
|
-
/**
|
|
2134
|
-
* Returns `true` if the value is a number object, e.g. created
|
|
2135
|
-
* by `new Number()`.
|
|
2136
|
-
*
|
|
2137
|
-
* ```js
|
|
2138
|
-
* util.types.isNumberObject(0); // Returns false
|
|
2139
|
-
* util.types.isNumberObject(new Number(0)); // Returns true
|
|
2140
|
-
* ```
|
|
2141
|
-
* @since v10.0.0
|
|
2142
|
-
*/
|
|
2143
|
-
function isNumberObject(object: unknown): object is Number;
|
|
2144
|
-
/**
|
|
2145
|
-
* Returns `true` if the value is a built-in [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
|
|
2146
|
-
*
|
|
2147
|
-
* ```js
|
|
2148
|
-
* util.types.isPromise(Promise.resolve(42)); // Returns true
|
|
2149
|
-
* ```
|
|
2150
|
-
* @since v10.0.0
|
|
2151
|
-
*/
|
|
2152
|
-
function isPromise(object: unknown): object is Promise<unknown>;
|
|
2153
|
-
/**
|
|
2154
|
-
* Returns `true` if the value is a [`Proxy`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) instance.
|
|
2155
|
-
*
|
|
2156
|
-
* ```js
|
|
2157
|
-
* const target = {};
|
|
2158
|
-
* const proxy = new Proxy(target, {});
|
|
2159
|
-
* util.types.isProxy(target); // Returns false
|
|
2160
|
-
* util.types.isProxy(proxy); // Returns true
|
|
2161
|
-
* ```
|
|
2162
|
-
* @since v10.0.0
|
|
2163
|
-
*/
|
|
2164
|
-
function isProxy(object: unknown): boolean;
|
|
2165
|
-
/**
|
|
2166
|
-
* Returns `true` if the value is a regular expression object.
|
|
2167
|
-
*
|
|
2168
|
-
* ```js
|
|
2169
|
-
* util.types.isRegExp(/abc/); // Returns true
|
|
2170
|
-
* util.types.isRegExp(new RegExp('abc')); // Returns true
|
|
2171
|
-
* ```
|
|
2172
|
-
* @since v10.0.0
|
|
2173
|
-
*/
|
|
2174
|
-
function isRegExp(object: unknown): object is RegExp;
|
|
2175
|
-
/**
|
|
2176
|
-
* Returns `true` if the value is a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance.
|
|
2177
|
-
*
|
|
2178
|
-
* ```js
|
|
2179
|
-
* util.types.isSet(new Set()); // Returns true
|
|
2180
|
-
* ```
|
|
2181
|
-
* @since v10.0.0
|
|
2182
|
-
*/
|
|
2183
|
-
function isSet<T>(
|
|
2184
|
-
object: T | {},
|
|
2185
|
-
): object is T extends ReadonlySet<any> ? (unknown extends T ? never : ReadonlySet<any>) : Set<unknown>;
|
|
2186
|
-
/**
|
|
2187
|
-
* 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.
|
|
2188
|
-
*
|
|
2189
|
-
* ```js
|
|
2190
|
-
* const set = new Set();
|
|
2191
|
-
* util.types.isSetIterator(set.keys()); // Returns true
|
|
2192
|
-
* util.types.isSetIterator(set.values()); // Returns true
|
|
2193
|
-
* util.types.isSetIterator(set.entries()); // Returns true
|
|
2194
|
-
* util.types.isSetIterator(set[Symbol.iterator]()); // Returns true
|
|
2195
|
-
* ```
|
|
2196
|
-
* @since v10.0.0
|
|
2197
|
-
*/
|
|
2198
|
-
function isSetIterator(object: unknown): boolean;
|
|
2199
|
-
/**
|
|
2200
|
-
* Returns `true` if the value is a built-in [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance.
|
|
2201
|
-
* This does _not_ include [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instances. Usually, it is
|
|
2202
|
-
* desirable to test for both; See `util.types.isAnyArrayBuffer()` for that.
|
|
2203
|
-
*
|
|
2204
|
-
* ```js
|
|
2205
|
-
* util.types.isSharedArrayBuffer(new ArrayBuffer()); // Returns false
|
|
2206
|
-
* util.types.isSharedArrayBuffer(new SharedArrayBuffer()); // Returns true
|
|
2207
|
-
* ```
|
|
2208
|
-
* @since v10.0.0
|
|
2209
|
-
*/
|
|
2210
|
-
function isSharedArrayBuffer(object: unknown): object is SharedArrayBuffer;
|
|
2211
|
-
/**
|
|
2212
|
-
* Returns `true` if the value is a string object, e.g. created
|
|
2213
|
-
* by `new String()`.
|
|
2214
|
-
*
|
|
2215
|
-
* ```js
|
|
2216
|
-
* util.types.isStringObject('foo'); // Returns false
|
|
2217
|
-
* util.types.isStringObject(new String('foo')); // Returns true
|
|
2218
|
-
* ```
|
|
2219
|
-
* @since v10.0.0
|
|
2220
|
-
*/
|
|
2221
|
-
function isStringObject(object: unknown): object is String;
|
|
2222
|
-
/**
|
|
2223
|
-
* Returns `true` if the value is a symbol object, created
|
|
2224
|
-
* by calling `Object()` on a `Symbol` primitive.
|
|
2225
|
-
*
|
|
2226
|
-
* ```js
|
|
2227
|
-
* const symbol = Symbol('foo');
|
|
2228
|
-
* util.types.isSymbolObject(symbol); // Returns false
|
|
2229
|
-
* util.types.isSymbolObject(Object(symbol)); // Returns true
|
|
2230
|
-
* ```
|
|
2231
|
-
* @since v10.0.0
|
|
2232
|
-
*/
|
|
2233
|
-
function isSymbolObject(object: unknown): object is Symbol;
|
|
2234
|
-
/**
|
|
2235
|
-
* Returns `true` if the value is a built-in [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) instance.
|
|
2236
|
-
*
|
|
2237
|
-
* ```js
|
|
2238
|
-
* util.types.isTypedArray(new ArrayBuffer()); // Returns false
|
|
2239
|
-
* util.types.isTypedArray(new Uint8Array()); // Returns true
|
|
2240
|
-
* util.types.isTypedArray(new Float64Array()); // Returns true
|
|
2241
|
-
* ```
|
|
2242
|
-
*
|
|
2243
|
-
* See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
|
|
2244
|
-
* @since v10.0.0
|
|
2245
|
-
*/
|
|
2246
|
-
function isTypedArray(object: unknown): object is NodeJS.TypedArray;
|
|
2247
|
-
/**
|
|
2248
|
-
* Returns `true` if the value is a built-in [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) instance.
|
|
2249
|
-
*
|
|
2250
|
-
* ```js
|
|
2251
|
-
* util.types.isUint8Array(new ArrayBuffer()); // Returns false
|
|
2252
|
-
* util.types.isUint8Array(new Uint8Array()); // Returns true
|
|
2253
|
-
* util.types.isUint8Array(new Float64Array()); // Returns false
|
|
2254
|
-
* ```
|
|
2255
|
-
* @since v10.0.0
|
|
2256
|
-
*/
|
|
2257
|
-
function isUint8Array(object: unknown): object is Uint8Array;
|
|
2258
|
-
/**
|
|
2259
|
-
* Returns `true` if the value is a built-in [`Uint8ClampedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray) instance.
|
|
2260
|
-
*
|
|
2261
|
-
* ```js
|
|
2262
|
-
* util.types.isUint8ClampedArray(new ArrayBuffer()); // Returns false
|
|
2263
|
-
* util.types.isUint8ClampedArray(new Uint8ClampedArray()); // Returns true
|
|
2264
|
-
* util.types.isUint8ClampedArray(new Float64Array()); // Returns false
|
|
2265
|
-
* ```
|
|
2266
|
-
* @since v10.0.0
|
|
2267
|
-
*/
|
|
2268
|
-
function isUint8ClampedArray(object: unknown): object is Uint8ClampedArray;
|
|
2269
|
-
/**
|
|
2270
|
-
* Returns `true` if the value is a built-in [`Uint16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array) instance.
|
|
2271
|
-
*
|
|
2272
|
-
* ```js
|
|
2273
|
-
* util.types.isUint16Array(new ArrayBuffer()); // Returns false
|
|
2274
|
-
* util.types.isUint16Array(new Uint16Array()); // Returns true
|
|
2275
|
-
* util.types.isUint16Array(new Float64Array()); // Returns false
|
|
2276
|
-
* ```
|
|
2277
|
-
* @since v10.0.0
|
|
2278
|
-
*/
|
|
2279
|
-
function isUint16Array(object: unknown): object is Uint16Array;
|
|
2280
|
-
/**
|
|
2281
|
-
* Returns `true` if the value is a built-in [`Uint32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array) instance.
|
|
2282
|
-
*
|
|
2283
|
-
* ```js
|
|
2284
|
-
* util.types.isUint32Array(new ArrayBuffer()); // Returns false
|
|
2285
|
-
* util.types.isUint32Array(new Uint32Array()); // Returns true
|
|
2286
|
-
* util.types.isUint32Array(new Float64Array()); // Returns false
|
|
2287
|
-
* ```
|
|
2288
|
-
* @since v10.0.0
|
|
2289
|
-
*/
|
|
2290
|
-
function isUint32Array(object: unknown): object is Uint32Array;
|
|
2291
|
-
/**
|
|
2292
|
-
* Returns `true` if the value is a built-in [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) instance.
|
|
2293
|
-
*
|
|
2294
|
-
* ```js
|
|
2295
|
-
* util.types.isWeakMap(new WeakMap()); // Returns true
|
|
2296
|
-
* ```
|
|
2297
|
-
* @since v10.0.0
|
|
2298
|
-
*/
|
|
2299
|
-
function isWeakMap(object: unknown): object is WeakMap<object, unknown>;
|
|
2300
|
-
/**
|
|
2301
|
-
* Returns `true` if the value is a built-in [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) instance.
|
|
2302
|
-
*
|
|
2303
|
-
* ```js
|
|
2304
|
-
* util.types.isWeakSet(new WeakSet()); // Returns true
|
|
2305
|
-
* ```
|
|
2306
|
-
* @since v10.0.0
|
|
2307
|
-
*/
|
|
2308
|
-
function isWeakSet(object: unknown): object is WeakSet<object>;
|
|
2309
|
-
/**
|
|
2310
|
-
* Returns `true` if `value` is a `KeyObject`, `false` otherwise.
|
|
2311
|
-
* @since v16.2.0
|
|
2312
|
-
*/
|
|
2313
|
-
function isKeyObject(object: unknown): object is KeyObject;
|
|
2314
|
-
/**
|
|
2315
|
-
* Returns `true` if `value` is a `CryptoKey`, `false` otherwise.
|
|
2316
|
-
* @since v16.2.0
|
|
2317
|
-
*/
|
|
2318
|
-
function isCryptoKey(object: unknown): object is webcrypto.CryptoKey;
|
|
2319
|
-
}
|
|
2320
|
-
declare module "node:util" {
|
|
2321
|
-
export * from "util";
|
|
2322
|
-
}
|
|
2323
|
-
declare module "node:util/types" {
|
|
2324
|
-
export * from "util/types";
|
|
1651
|
+
declare module "util" {
|
|
1652
|
+
export * from "node:util";
|
|
2325
1653
|
}
|