m06_task3.js 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. package/.idea/.name +1 -0
  2. package/.idea/inspectionProfiles/Project_Default.xml +10 -0
  3. package/.idea/jsLibraryMappings.xml +6 -0
  4. package/.idea/modules.xml +8 -0
  5. package/.idea/node_lab_6.iml +12 -0
  6. package/06_task2.html +73 -0
  7. package/06_task2.js +52 -0
  8. package/06_task3.js +3 -0
  9. package/06_task4.js +3 -0
  10. package/m06_task3.js +28 -0
  11. package/package/index.js +28 -0
  12. package/package/node_modules/.package-lock.json +31 -0
  13. package/package/node_modules/@types/node/LICENSE +21 -0
  14. package/package/node_modules/@types/node/README.md +16 -0
  15. package/package/node_modules/@types/node/assert/strict.d.ts +8 -0
  16. package/package/node_modules/@types/node/assert.d.ts +961 -0
  17. package/package/node_modules/@types/node/async_hooks.d.ts +501 -0
  18. package/package/node_modules/@types/node/buffer.d.ts +2258 -0
  19. package/package/node_modules/@types/node/child_process.d.ts +1369 -0
  20. package/package/node_modules/@types/node/cluster.d.ts +410 -0
  21. package/package/node_modules/@types/node/console.d.ts +412 -0
  22. package/package/node_modules/@types/node/constants.d.ts +18 -0
  23. package/package/node_modules/@types/node/crypto.d.ts +3964 -0
  24. package/package/node_modules/@types/node/dgram.d.ts +545 -0
  25. package/package/node_modules/@types/node/diagnostics_channel.d.ts +153 -0
  26. package/package/node_modules/@types/node/dns/promises.d.ts +370 -0
  27. package/package/node_modules/@types/node/dns.d.ts +659 -0
  28. package/package/node_modules/@types/node/dom-events.d.ts +126 -0
  29. package/package/node_modules/@types/node/domain.d.ts +170 -0
  30. package/package/node_modules/@types/node/events.d.ts +678 -0
  31. package/package/node_modules/@types/node/fs/promises.d.ts +1138 -0
  32. package/package/node_modules/@types/node/fs.d.ts +3872 -0
  33. package/package/node_modules/@types/node/globals.d.ts +300 -0
  34. package/package/node_modules/@types/node/globals.global.d.ts +1 -0
  35. package/package/node_modules/@types/node/http.d.ts +1614 -0
  36. package/package/node_modules/@types/node/http2.d.ts +2134 -0
  37. package/package/node_modules/@types/node/https.d.ts +541 -0
  38. package/package/node_modules/@types/node/index.d.ts +133 -0
  39. package/package/node_modules/@types/node/inspector.d.ts +2741 -0
  40. package/package/node_modules/@types/node/module.d.ts +114 -0
  41. package/package/node_modules/@types/node/net.d.ts +869 -0
  42. package/package/node_modules/@types/node/os.d.ts +466 -0
  43. package/package/node_modules/@types/node/package.json +232 -0
  44. package/package/node_modules/@types/node/path.d.ts +191 -0
  45. package/package/node_modules/@types/node/perf_hooks.d.ts +625 -0
  46. package/package/node_modules/@types/node/process.d.ts +1482 -0
  47. package/package/node_modules/@types/node/punycode.d.ts +117 -0
  48. package/package/node_modules/@types/node/querystring.d.ts +131 -0
  49. package/package/node_modules/@types/node/readline/promises.d.ts +143 -0
  50. package/package/node_modules/@types/node/readline.d.ts +653 -0
  51. package/package/node_modules/@types/node/repl.d.ts +424 -0
  52. package/package/node_modules/@types/node/stream/consumers.d.ts +12 -0
  53. package/package/node_modules/@types/node/stream/promises.d.ts +42 -0
  54. package/package/node_modules/@types/node/stream/web.d.ts +330 -0
  55. package/package/node_modules/@types/node/stream.d.ts +1340 -0
  56. package/package/node_modules/@types/node/string_decoder.d.ts +67 -0
  57. package/package/node_modules/@types/node/test.d.ts +314 -0
  58. package/package/node_modules/@types/node/timers/promises.d.ts +68 -0
  59. package/package/node_modules/@types/node/timers.d.ts +94 -0
  60. package/package/node_modules/@types/node/tls.d.ts +1028 -0
  61. package/package/node_modules/@types/node/trace_events.d.ts +171 -0
  62. package/package/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
  63. package/package/node_modules/@types/node/ts4.8/assert.d.ts +961 -0
  64. package/package/node_modules/@types/node/ts4.8/async_hooks.d.ts +501 -0
  65. package/package/node_modules/@types/node/ts4.8/buffer.d.ts +2259 -0
  66. package/package/node_modules/@types/node/ts4.8/child_process.d.ts +1369 -0
  67. package/package/node_modules/@types/node/ts4.8/cluster.d.ts +410 -0
  68. package/package/node_modules/@types/node/ts4.8/console.d.ts +412 -0
  69. package/package/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
  70. package/package/node_modules/@types/node/ts4.8/crypto.d.ts +3964 -0
  71. package/package/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
  72. package/package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +153 -0
  73. package/package/node_modules/@types/node/ts4.8/dns/promises.d.ts +370 -0
  74. package/package/node_modules/@types/node/ts4.8/dns.d.ts +659 -0
  75. package/package/node_modules/@types/node/ts4.8/dom-events.d.ts +126 -0
  76. package/package/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
  77. package/package/node_modules/@types/node/ts4.8/events.d.ts +678 -0
  78. package/package/node_modules/@types/node/ts4.8/fs/promises.d.ts +1138 -0
  79. package/package/node_modules/@types/node/ts4.8/fs.d.ts +3872 -0
  80. package/package/node_modules/@types/node/ts4.8/globals.d.ts +294 -0
  81. package/package/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
  82. package/package/node_modules/@types/node/ts4.8/http.d.ts +1614 -0
  83. package/package/node_modules/@types/node/ts4.8/http2.d.ts +2134 -0
  84. package/package/node_modules/@types/node/ts4.8/https.d.ts +541 -0
  85. package/package/node_modules/@types/node/ts4.8/index.d.ts +88 -0
  86. package/package/node_modules/@types/node/ts4.8/inspector.d.ts +2741 -0
  87. package/package/node_modules/@types/node/ts4.8/module.d.ts +114 -0
  88. package/package/node_modules/@types/node/ts4.8/net.d.ts +869 -0
  89. package/package/node_modules/@types/node/ts4.8/os.d.ts +466 -0
  90. package/package/node_modules/@types/node/ts4.8/path.d.ts +191 -0
  91. package/package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +625 -0
  92. package/package/node_modules/@types/node/ts4.8/process.d.ts +1482 -0
  93. package/package/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
  94. package/package/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
  95. package/package/node_modules/@types/node/ts4.8/readline/promises.d.ts +143 -0
  96. package/package/node_modules/@types/node/ts4.8/readline.d.ts +653 -0
  97. package/package/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
  98. package/package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
  99. package/package/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
  100. package/package/node_modules/@types/node/ts4.8/stream/web.d.ts +330 -0
  101. package/package/node_modules/@types/node/ts4.8/stream.d.ts +1340 -0
  102. package/package/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
  103. package/package/node_modules/@types/node/ts4.8/test.d.ts +314 -0
  104. package/package/node_modules/@types/node/ts4.8/timers/promises.d.ts +68 -0
  105. package/package/node_modules/@types/node/ts4.8/timers.d.ts +94 -0
  106. package/package/node_modules/@types/node/ts4.8/tls.d.ts +1028 -0
  107. package/package/node_modules/@types/node/ts4.8/trace_events.d.ts +171 -0
  108. package/package/node_modules/@types/node/ts4.8/tty.d.ts +206 -0
  109. package/package/node_modules/@types/node/ts4.8/url.d.ts +897 -0
  110. package/package/node_modules/@types/node/ts4.8/util.d.ts +1850 -0
  111. package/package/node_modules/@types/node/ts4.8/v8.d.ts +396 -0
  112. package/package/node_modules/@types/node/ts4.8/vm.d.ts +509 -0
  113. package/package/node_modules/@types/node/ts4.8/wasi.d.ts +158 -0
  114. package/package/node_modules/@types/node/ts4.8/worker_threads.d.ts +689 -0
  115. package/package/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
  116. package/package/node_modules/@types/node/tty.d.ts +206 -0
  117. package/package/node_modules/@types/node/url.d.ts +897 -0
  118. package/package/node_modules/@types/node/util.d.ts +1850 -0
  119. package/package/node_modules/@types/node/v8.d.ts +396 -0
  120. package/package/node_modules/@types/node/vm.d.ts +509 -0
  121. package/package/node_modules/@types/node/wasi.d.ts +158 -0
  122. package/package/node_modules/@types/node/worker_threads.d.ts +689 -0
  123. package/package/node_modules/@types/node/zlib.d.ts +517 -0
  124. package/package/node_modules/@types/nodemailer/LICENSE +21 -0
  125. package/package/node_modules/@types/nodemailer/README.md +16 -0
  126. package/package/node_modules/@types/nodemailer/index.d.ts +83 -0
  127. package/package/node_modules/@types/nodemailer/lib/addressparser/index.d.ts +31 -0
  128. package/package/node_modules/@types/nodemailer/lib/base64/index.d.ts +22 -0
  129. package/package/node_modules/@types/nodemailer/lib/dkim/index.d.ts +45 -0
  130. package/package/node_modules/@types/nodemailer/lib/dkim/message-parser.d.ts +75 -0
  131. package/package/node_modules/@types/nodemailer/lib/dkim/relaxed-body.d.ts +75 -0
  132. package/package/node_modules/@types/nodemailer/lib/dkim/sign.d.ts +11 -0
  133. package/package/node_modules/@types/nodemailer/lib/fetch/cookies.d.ts +54 -0
  134. package/package/node_modules/@types/nodemailer/lib/fetch/index.d.ts +38 -0
  135. package/package/node_modules/@types/nodemailer/lib/json-transport/index.d.ts +50 -0
  136. package/package/node_modules/@types/nodemailer/lib/mail-composer/index.d.ts +25 -0
  137. package/package/node_modules/@types/nodemailer/lib/mailer/index.d.ts +230 -0
  138. package/package/node_modules/@types/nodemailer/lib/mailer/mail-message.d.ts +28 -0
  139. package/package/node_modules/@types/nodemailer/lib/mime-funcs/index.d.ts +87 -0
  140. package/package/node_modules/@types/nodemailer/lib/mime-funcs/mime-types.d.ts +2 -0
  141. package/package/node_modules/@types/nodemailer/lib/mime-node/index.d.ts +137 -0
  142. package/package/node_modules/@types/nodemailer/lib/mime-node/last-newline.d.ts +9 -0
  143. package/package/node_modules/@types/nodemailer/lib/qp/index.d.ts +23 -0
  144. package/package/node_modules/@types/nodemailer/lib/sendmail-transport/index.d.ts +53 -0
  145. package/package/node_modules/@types/nodemailer/lib/sendmail-transport/le-unix.d.ts +7 -0
  146. package/package/node_modules/@types/nodemailer/lib/sendmail-transport/le-windows.d.ts +7 -0
  147. package/package/node_modules/@types/nodemailer/lib/ses-transport/index.d.ts +136 -0
  148. package/package/node_modules/@types/nodemailer/lib/shared/index.d.ts +51 -0
  149. package/package/node_modules/@types/nodemailer/lib/smtp-connection/data-stream.d.ts +11 -0
  150. package/package/node_modules/@types/nodemailer/lib/smtp-connection/http-proxy-client.d.ts +11 -0
  151. package/package/node_modules/@types/nodemailer/lib/smtp-connection/index.d.ts +254 -0
  152. package/package/node_modules/@types/nodemailer/lib/smtp-pool/index.d.ts +90 -0
  153. package/package/node_modules/@types/nodemailer/lib/smtp-pool/pool-resource.d.ts +66 -0
  154. package/package/node_modules/@types/nodemailer/lib/smtp-transport/index.d.ts +115 -0
  155. package/package/node_modules/@types/nodemailer/lib/stream-transport/index.d.ts +56 -0
  156. package/package/node_modules/@types/nodemailer/lib/well-known/index.d.ts +6 -0
  157. package/package/node_modules/@types/nodemailer/lib/xoauth2/index.d.ts +110 -0
  158. package/package/node_modules/@types/nodemailer/package.json +37 -0
  159. package/package/node_modules/nodemailer/.gitattributes +6 -0
  160. package/package/node_modules/nodemailer/.prettierrc.js +8 -0
  161. package/package/node_modules/nodemailer/CHANGELOG.md +715 -0
  162. package/package/node_modules/nodemailer/CODE_OF_CONDUCT.md +76 -0
  163. package/package/node_modules/nodemailer/CONTRIBUTING.md +67 -0
  164. package/package/node_modules/nodemailer/LICENSE +16 -0
  165. package/package/node_modules/nodemailer/README.md +93 -0
  166. package/package/node_modules/nodemailer/SECURITY.txt +22 -0
  167. package/package/node_modules/nodemailer/lib/addressparser/index.js +313 -0
  168. package/package/node_modules/nodemailer/lib/base64/index.js +142 -0
  169. package/package/node_modules/nodemailer/lib/dkim/index.js +251 -0
  170. package/package/node_modules/nodemailer/lib/dkim/message-parser.js +155 -0
  171. package/package/node_modules/nodemailer/lib/dkim/relaxed-body.js +154 -0
  172. package/package/node_modules/nodemailer/lib/dkim/sign.js +117 -0
  173. package/package/node_modules/nodemailer/lib/fetch/cookies.js +281 -0
  174. package/package/node_modules/nodemailer/lib/fetch/index.js +269 -0
  175. package/package/node_modules/nodemailer/lib/json-transport/index.js +82 -0
  176. package/package/node_modules/nodemailer/lib/mail-composer/index.js +558 -0
  177. package/package/node_modules/nodemailer/lib/mailer/index.js +427 -0
  178. package/package/node_modules/nodemailer/lib/mailer/mail-message.js +315 -0
  179. package/package/node_modules/nodemailer/lib/mime-funcs/index.js +619 -0
  180. package/package/node_modules/nodemailer/lib/mime-funcs/mime-types.js +2102 -0
  181. package/package/node_modules/nodemailer/lib/mime-node/index.js +1290 -0
  182. package/package/node_modules/nodemailer/lib/mime-node/last-newline.js +33 -0
  183. package/package/node_modules/nodemailer/lib/mime-node/le-unix.js +43 -0
  184. package/package/node_modules/nodemailer/lib/mime-node/le-windows.js +52 -0
  185. package/package/node_modules/nodemailer/lib/nodemailer.js +143 -0
  186. package/package/node_modules/nodemailer/lib/qp/index.js +219 -0
  187. package/package/node_modules/nodemailer/lib/sendmail-transport/index.js +210 -0
  188. package/package/node_modules/nodemailer/lib/ses-transport/index.js +349 -0
  189. package/package/node_modules/nodemailer/lib/shared/index.js +639 -0
  190. package/package/node_modules/nodemailer/lib/smtp-connection/data-stream.js +108 -0
  191. package/package/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +143 -0
  192. package/package/node_modules/nodemailer/lib/smtp-connection/index.js +1786 -0
  193. package/package/node_modules/nodemailer/lib/smtp-pool/index.js +648 -0
  194. package/package/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +253 -0
  195. package/package/node_modules/nodemailer/lib/smtp-transport/index.js +416 -0
  196. package/package/node_modules/nodemailer/lib/stream-transport/index.js +135 -0
  197. package/package/node_modules/nodemailer/lib/well-known/index.js +47 -0
  198. package/package/node_modules/nodemailer/lib/well-known/services.json +286 -0
  199. package/package/node_modules/nodemailer/lib/xoauth2/index.js +376 -0
  200. package/package/node_modules/nodemailer/package.json +46 -0
  201. package/package/node_modules/nodemailer/postinstall.js +101 -0
  202. package/package/package-lock.json +60 -0
  203. package/package/package.json +6 -0
  204. package/package.json +19 -0
@@ -0,0 +1,1850 @@
1
+ /**
2
+ * The `util` module supports the needs of Node.js internal APIs. Many of the
3
+ * utilities are useful for application and module developers as well. To access
4
+ * it:
5
+ *
6
+ * ```js
7
+ * const util = require('util');
8
+ * ```
9
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/util.js)
10
+ */
11
+ declare module 'util' {
12
+ import * as types from 'node:util/types';
13
+ export interface InspectOptions {
14
+ /**
15
+ * If set to `true`, getters are going to be
16
+ * inspected as well. If set to `'get'` only getters without setter are going
17
+ * to be inspected. If set to `'set'` only getters having a corresponding
18
+ * setter are going to be inspected. This might cause side effects depending on
19
+ * the getter function.
20
+ * @default `false`
21
+ */
22
+ getters?: 'get' | 'set' | boolean | undefined;
23
+ showHidden?: boolean | undefined;
24
+ /**
25
+ * @default 2
26
+ */
27
+ depth?: number | null | undefined;
28
+ colors?: boolean | undefined;
29
+ customInspect?: boolean | undefined;
30
+ showProxy?: boolean | undefined;
31
+ maxArrayLength?: number | null | undefined;
32
+ /**
33
+ * Specifies the maximum number of characters to
34
+ * include when formatting. Set to `null` or `Infinity` to show all elements.
35
+ * Set to `0` or negative to show no characters.
36
+ * @default 10000
37
+ */
38
+ maxStringLength?: number | null | undefined;
39
+ breakLength?: number | undefined;
40
+ /**
41
+ * Setting this to `false` causes each object key
42
+ * to be displayed on a new line. It will also add new lines to text that is
43
+ * longer than `breakLength`. If set to a number, the most `n` inner elements
44
+ * are united on a single line as long as all properties fit into
45
+ * `breakLength`. Short array elements are also grouped together. Note that no
46
+ * text will be reduced below 16 characters, no matter the `breakLength` size.
47
+ * For more information, see the example below.
48
+ * @default `true`
49
+ */
50
+ compact?: boolean | number | undefined;
51
+ sorted?: boolean | ((a: string, b: string) => number) | undefined;
52
+ }
53
+ export type Style = 'special' | 'number' | 'bigint' | 'boolean' | 'undefined' | 'null' | 'string' | 'symbol' | 'date' | 'regexp' | 'module';
54
+ export type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => string;
55
+ export interface InspectOptionsStylized extends InspectOptions {
56
+ stylize(text: string, styleType: Style): string;
57
+ }
58
+ /**
59
+ * The `util.format()` method returns a formatted string using the first argument
60
+ * as a `printf`\-like format string which can contain zero or more format
61
+ * specifiers. Each specifier is replaced with the converted value from the
62
+ * corresponding argument. Supported specifiers are:
63
+ *
64
+ * If a specifier does not have a corresponding argument, it is not replaced:
65
+ *
66
+ * ```js
67
+ * util.format('%s:%s', 'foo');
68
+ * // Returns: 'foo:%s'
69
+ * ```
70
+ *
71
+ * Values that are not part of the format string are formatted using`util.inspect()` if their type is not `string`.
72
+ *
73
+ * If there are more arguments passed to the `util.format()` method than the
74
+ * number of specifiers, the extra arguments are concatenated to the returned
75
+ * string, separated by spaces:
76
+ *
77
+ * ```js
78
+ * util.format('%s:%s', 'foo', 'bar', 'baz');
79
+ * // Returns: 'foo:bar baz'
80
+ * ```
81
+ *
82
+ * If the first argument does not contain a valid format specifier, `util.format()`returns a string that is the concatenation of all arguments separated by spaces:
83
+ *
84
+ * ```js
85
+ * util.format(1, 2, 3);
86
+ * // Returns: '1 2 3'
87
+ * ```
88
+ *
89
+ * If only one argument is passed to `util.format()`, it is returned as it is
90
+ * without any formatting:
91
+ *
92
+ * ```js
93
+ * util.format('%% %s');
94
+ * // Returns: '%% %s'
95
+ * ```
96
+ *
97
+ * `util.format()` is a synchronous method that is intended as a debugging tool.
98
+ * Some input values can have a significant performance overhead that can block the
99
+ * event loop. Use this function with care and never in a hot code path.
100
+ * @since v0.5.3
101
+ * @param format A `printf`-like format string.
102
+ */
103
+ export function format(format?: any, ...param: any[]): string;
104
+ /**
105
+ * This function is identical to {@link format}, except in that it takes
106
+ * an `inspectOptions` argument which specifies options that are passed along to {@link inspect}.
107
+ *
108
+ * ```js
109
+ * util.formatWithOptions({ colors: true }, 'See object %O', { foo: 42 });
110
+ * // Returns 'See object { foo: 42 }', where `42` is colored as a number
111
+ * // when printed to a terminal.
112
+ * ```
113
+ * @since v10.0.0
114
+ */
115
+ export function formatWithOptions(inspectOptions: InspectOptions, format?: any, ...param: any[]): string;
116
+ /**
117
+ * Returns the string name for a numeric error code that comes from a Node.js API.
118
+ * The mapping between error codes and error names is platform-dependent.
119
+ * See `Common System Errors` for the names of common errors.
120
+ *
121
+ * ```js
122
+ * fs.access('file/that/does/not/exist', (err) => {
123
+ * const name = util.getSystemErrorName(err.errno);
124
+ * console.error(name); // ENOENT
125
+ * });
126
+ * ```
127
+ * @since v9.7.0
128
+ */
129
+ export function getSystemErrorName(err: number): string;
130
+ /**
131
+ * Returns a Map of all system error codes available from the Node.js API.
132
+ * The mapping between error codes and error names is platform-dependent.
133
+ * See `Common System Errors` for the names of common errors.
134
+ *
135
+ * ```js
136
+ * fs.access('file/that/does/not/exist', (err) => {
137
+ * const errorMap = util.getSystemErrorMap();
138
+ * const name = errorMap.get(err.errno);
139
+ * console.error(name); // ENOENT
140
+ * });
141
+ * ```
142
+ * @since v16.0.0, v14.17.0
143
+ */
144
+ export function getSystemErrorMap(): Map<number, [string, string]>;
145
+ /**
146
+ * The `util.log()` method prints the given `string` to `stdout` with an included
147
+ * timestamp.
148
+ *
149
+ * ```js
150
+ * const util = require('util');
151
+ *
152
+ * util.log('Timestamped message.');
153
+ * ```
154
+ * @since v0.3.0
155
+ * @deprecated Since v6.0.0 - Use a third party module instead.
156
+ */
157
+ export function log(string: string): void;
158
+ /**
159
+ * Returns the `string` after replacing any surrogate code points
160
+ * (or equivalently, any unpaired surrogate code units) with the
161
+ * Unicode "replacement character" U+FFFD.
162
+ * @since v16.8.0, v14.18.0
163
+ */
164
+ export function toUSVString(string: string): string;
165
+ /**
166
+ * Creates and returns an `AbortController` instance whose `AbortSignal` is marked
167
+ * as transferable and can be used with `structuredClone()` or `postMessage()`.
168
+ * @since v18.11.0
169
+ * @returns A transferable AbortController
170
+ */
171
+ export function transferableAbortController(): AbortController;
172
+ /**
173
+ * Marks the given {AbortSignal} as transferable so that it can be used with
174
+ * `structuredClone()` and `postMessage()`.
175
+ *
176
+ * ```js
177
+ * const signal = transferableAbortSignal(AbortSignal.timeout(100));
178
+ * const channel = new MessageChannel();
179
+ * channel.port2.postMessage(signal, [signal]);
180
+ * ```
181
+ * @since v18.11.0
182
+ * @param signal The AbortSignal
183
+ * @returns The same AbortSignal
184
+ */
185
+ export function transferableAbortSignal(signal: AbortSignal): AbortSignal;
186
+ /**
187
+ * The `util.inspect()` method returns a string representation of `object` that is
188
+ * intended for debugging. The output of `util.inspect` may change at any time
189
+ * and should not be depended upon programmatically. Additional `options` may be
190
+ * passed that alter the result.`util.inspect()` will use the constructor's name and/or `@@toStringTag` to make
191
+ * an identifiable tag for an inspected value.
192
+ *
193
+ * ```js
194
+ * class Foo {
195
+ * get [Symbol.toStringTag]() {
196
+ * return 'bar';
197
+ * }
198
+ * }
199
+ *
200
+ * class Bar {}
201
+ *
202
+ * const baz = Object.create(null, { [Symbol.toStringTag]: { value: 'foo' } });
203
+ *
204
+ * util.inspect(new Foo()); // 'Foo [bar] {}'
205
+ * util.inspect(new Bar()); // 'Bar {}'
206
+ * util.inspect(baz); // '[foo] {}'
207
+ * ```
208
+ *
209
+ * Circular references point to their anchor by using a reference index:
210
+ *
211
+ * ```js
212
+ * const { inspect } = require('util');
213
+ *
214
+ * const obj = {};
215
+ * obj.a = [obj];
216
+ * obj.b = {};
217
+ * obj.b.inner = obj.b;
218
+ * obj.b.obj = obj;
219
+ *
220
+ * console.log(inspect(obj));
221
+ * // <ref *1> {
222
+ * // a: [ [Circular *1] ],
223
+ * // b: <ref *2> { inner: [Circular *2], obj: [Circular *1] }
224
+ * // }
225
+ * ```
226
+ *
227
+ * The following example inspects all properties of the `util` object:
228
+ *
229
+ * ```js
230
+ * const util = require('util');
231
+ *
232
+ * console.log(util.inspect(util, { showHidden: true, depth: null }));
233
+ * ```
234
+ *
235
+ * The following example highlights the effect of the `compact` option:
236
+ *
237
+ * ```js
238
+ * const util = require('util');
239
+ *
240
+ * const o = {
241
+ * a: [1, 2, [[
242
+ * 'Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit, sed do ' +
243
+ * 'eiusmod \ntempor incididunt ut labore et dolore magna aliqua.',
244
+ * 'test',
245
+ * 'foo']], 4],
246
+ * b: new Map([['za', 1], ['zb', 'test']])
247
+ * };
248
+ * console.log(util.inspect(o, { compact: true, depth: 5, breakLength: 80 }));
249
+ *
250
+ * // { a:
251
+ * // [ 1,
252
+ * // 2,
253
+ * // [ [ 'Lorem ipsum dolor sit amet,\nconsectetur [...]', // A long line
254
+ * // 'test',
255
+ * // 'foo' ] ],
256
+ * // 4 ],
257
+ * // b: Map(2) { 'za' => 1, 'zb' => 'test' } }
258
+ *
259
+ * // Setting `compact` to false or an integer creates more reader friendly output.
260
+ * console.log(util.inspect(o, { compact: false, depth: 5, breakLength: 80 }));
261
+ *
262
+ * // {
263
+ * // a: [
264
+ * // 1,
265
+ * // 2,
266
+ * // [
267
+ * // [
268
+ * // 'Lorem ipsum dolor sit amet,\n' +
269
+ * // 'consectetur adipiscing elit, sed do eiusmod \n' +
270
+ * // 'tempor incididunt ut labore et dolore magna aliqua.',
271
+ * // 'test',
272
+ * // 'foo'
273
+ * // ]
274
+ * // ],
275
+ * // 4
276
+ * // ],
277
+ * // b: Map(2) {
278
+ * // 'za' => 1,
279
+ * // 'zb' => 'test'
280
+ * // }
281
+ * // }
282
+ *
283
+ * // Setting `breakLength` to e.g. 150 will print the "Lorem ipsum" text in a
284
+ * // single line.
285
+ * ```
286
+ *
287
+ * The `showHidden` option allows [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) and
288
+ * [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) entries to be
289
+ * inspected. If there are more entries than `maxArrayLength`, there is no
290
+ * guarantee which entries are displayed. That means retrieving the same [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) entries twice may
291
+ * result in different output. Furthermore, entries
292
+ * with no remaining strong references may be garbage collected at any time.
293
+ *
294
+ * ```js
295
+ * const { inspect } = require('util');
296
+ *
297
+ * const obj = { a: 1 };
298
+ * const obj2 = { b: 2 };
299
+ * const weakSet = new WeakSet([obj, obj2]);
300
+ *
301
+ * console.log(inspect(weakSet, { showHidden: true }));
302
+ * // WeakSet { { a: 1 }, { b: 2 } }
303
+ * ```
304
+ *
305
+ * The `sorted` option ensures that an object's property insertion order does not
306
+ * impact the result of `util.inspect()`.
307
+ *
308
+ * ```js
309
+ * const { inspect } = require('util');
310
+ * const assert = require('assert');
311
+ *
312
+ * const o1 = {
313
+ * b: [2, 3, 1],
314
+ * a: '`a` comes before `b`',
315
+ * c: new Set([2, 3, 1])
316
+ * };
317
+ * console.log(inspect(o1, { sorted: true }));
318
+ * // { a: '`a` comes before `b`', b: [ 2, 3, 1 ], c: Set(3) { 1, 2, 3 } }
319
+ * console.log(inspect(o1, { sorted: (a, b) => b.localeCompare(a) }));
320
+ * // { c: Set(3) { 3, 2, 1 }, b: [ 2, 3, 1 ], a: '`a` comes before `b`' }
321
+ *
322
+ * const o2 = {
323
+ * c: new Set([2, 1, 3]),
324
+ * a: '`a` comes before `b`',
325
+ * b: [2, 3, 1]
326
+ * };
327
+ * assert.strict.equal(
328
+ * inspect(o1, { sorted: true }),
329
+ * inspect(o2, { sorted: true })
330
+ * );
331
+ * ```
332
+ *
333
+ * The `numericSeparator` option adds an underscore every three digits to all
334
+ * numbers.
335
+ *
336
+ * ```js
337
+ * const { inspect } = require('util');
338
+ *
339
+ * const thousand = 1_000;
340
+ * const million = 1_000_000;
341
+ * const bigNumber = 123_456_789n;
342
+ * const bigDecimal = 1_234.123_45;
343
+ *
344
+ * console.log(thousand, million, bigNumber, bigDecimal);
345
+ * // 1_000 1_000_000 123_456_789n 1_234.123_45
346
+ * ```
347
+ *
348
+ * `util.inspect()` is a synchronous method intended for debugging. Its maximum
349
+ * output length is approximately 128 MB. Inputs that result in longer output will
350
+ * be truncated.
351
+ * @since v0.3.0
352
+ * @param object Any JavaScript primitive or `Object`.
353
+ * @return The representation of `object`.
354
+ */
355
+ export function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
356
+ export function inspect(object: any, options?: InspectOptions): string;
357
+ export namespace inspect {
358
+ let colors: NodeJS.Dict<[number, number]>;
359
+ let styles: {
360
+ [K in Style]: string;
361
+ };
362
+ let defaultOptions: InspectOptions;
363
+ /**
364
+ * Allows changing inspect settings from the repl.
365
+ */
366
+ let replDefaults: InspectOptions;
367
+ /**
368
+ * That can be used to declare custom inspect functions.
369
+ */
370
+ const custom: unique symbol;
371
+ }
372
+ /**
373
+ * Alias for [`Array.isArray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray).
374
+ *
375
+ * Returns `true` if the given `object` is an `Array`. Otherwise, returns `false`.
376
+ *
377
+ * ```js
378
+ * const util = require('util');
379
+ *
380
+ * util.isArray([]);
381
+ * // Returns: true
382
+ * util.isArray(new Array());
383
+ * // Returns: true
384
+ * util.isArray({});
385
+ * // Returns: false
386
+ * ```
387
+ * @since v0.6.0
388
+ * @deprecated Since v4.0.0 - Use `isArray` instead.
389
+ */
390
+ export function isArray(object: unknown): object is unknown[];
391
+ /**
392
+ * Returns `true` if the given `object` is a `RegExp`. Otherwise, returns `false`.
393
+ *
394
+ * ```js
395
+ * const util = require('util');
396
+ *
397
+ * util.isRegExp(/some regexp/);
398
+ * // Returns: true
399
+ * util.isRegExp(new RegExp('another regexp'));
400
+ * // Returns: true
401
+ * util.isRegExp({});
402
+ * // Returns: false
403
+ * ```
404
+ * @since v0.6.0
405
+ * @deprecated Since v4.0.0 - Deprecated
406
+ */
407
+ export function isRegExp(object: unknown): object is RegExp;
408
+ /**
409
+ * Returns `true` if the given `object` is a `Date`. Otherwise, returns `false`.
410
+ *
411
+ * ```js
412
+ * const util = require('util');
413
+ *
414
+ * util.isDate(new Date());
415
+ * // Returns: true
416
+ * util.isDate(Date());
417
+ * // false (without 'new' returns a String)
418
+ * util.isDate({});
419
+ * // Returns: false
420
+ * ```
421
+ * @since v0.6.0
422
+ * @deprecated Since v4.0.0 - Use {@link types.isDate} instead.
423
+ */
424
+ export function isDate(object: unknown): object is Date;
425
+ /**
426
+ * Returns `true` if the given `object` is an `Error`. Otherwise, returns`false`.
427
+ *
428
+ * ```js
429
+ * const util = require('util');
430
+ *
431
+ * util.isError(new Error());
432
+ * // Returns: true
433
+ * util.isError(new TypeError());
434
+ * // Returns: true
435
+ * util.isError({ name: 'Error', message: 'an error occurred' });
436
+ * // Returns: false
437
+ * ```
438
+ *
439
+ * This method relies on `Object.prototype.toString()` behavior. It is
440
+ * possible to obtain an incorrect result when the `object` argument manipulates`@@toStringTag`.
441
+ *
442
+ * ```js
443
+ * const util = require('util');
444
+ * const obj = { name: 'Error', message: 'an error occurred' };
445
+ *
446
+ * util.isError(obj);
447
+ * // Returns: false
448
+ * obj[Symbol.toStringTag] = 'Error';
449
+ * util.isError(obj);
450
+ * // Returns: true
451
+ * ```
452
+ * @since v0.6.0
453
+ * @deprecated Since v4.0.0 - Use {@link types.isNativeError} instead.
454
+ */
455
+ export function isError(object: unknown): object is Error;
456
+ /**
457
+ * Usage of `util.inherits()` is discouraged. Please use the ES6 `class` and`extends` keywords to get language level inheritance support. Also note
458
+ * that the two styles are [semantically incompatible](https://github.com/nodejs/node/issues/4179).
459
+ *
460
+ * Inherit the prototype methods from one [constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor) into another. The
461
+ * prototype of `constructor` will be set to a new object created from`superConstructor`.
462
+ *
463
+ * This mainly adds some input validation on top of`Object.setPrototypeOf(constructor.prototype, superConstructor.prototype)`.
464
+ * As an additional convenience, `superConstructor` will be accessible
465
+ * through the `constructor.super_` property.
466
+ *
467
+ * ```js
468
+ * const util = require('util');
469
+ * const EventEmitter = require('events');
470
+ *
471
+ * function MyStream() {
472
+ * EventEmitter.call(this);
473
+ * }
474
+ *
475
+ * util.inherits(MyStream, EventEmitter);
476
+ *
477
+ * MyStream.prototype.write = function(data) {
478
+ * this.emit('data', data);
479
+ * };
480
+ *
481
+ * const stream = new MyStream();
482
+ *
483
+ * console.log(stream instanceof EventEmitter); // true
484
+ * console.log(MyStream.super_ === EventEmitter); // true
485
+ *
486
+ * stream.on('data', (data) => {
487
+ * console.log(`Received data: "${data}"`);
488
+ * });
489
+ * stream.write('It works!'); // Received data: "It works!"
490
+ * ```
491
+ *
492
+ * ES6 example using `class` and `extends`:
493
+ *
494
+ * ```js
495
+ * const EventEmitter = require('events');
496
+ *
497
+ * class MyStream extends EventEmitter {
498
+ * write(data) {
499
+ * this.emit('data', data);
500
+ * }
501
+ * }
502
+ *
503
+ * const stream = new MyStream();
504
+ *
505
+ * stream.on('data', (data) => {
506
+ * console.log(`Received data: "${data}"`);
507
+ * });
508
+ * stream.write('With ES6');
509
+ * ```
510
+ * @since v0.3.0
511
+ * @deprecated Legacy: Use ES2015 class syntax and `extends` keyword instead.
512
+ */
513
+ export function inherits(constructor: unknown, superConstructor: unknown): void;
514
+ export type DebugLoggerFunction = (msg: string, ...param: unknown[]) => void;
515
+ export interface DebugLogger extends DebugLoggerFunction {
516
+ enabled: boolean;
517
+ }
518
+ /**
519
+ * The `util.debuglog()` method is used to create a function that conditionally
520
+ * writes debug messages to `stderr` based on the existence of the `NODE_DEBUG`environment variable. If the `section` name appears within the value of that
521
+ * environment variable, then the returned function operates similar to `console.error()`. If not, then the returned function is a no-op.
522
+ *
523
+ * ```js
524
+ * const util = require('util');
525
+ * const debuglog = util.debuglog('foo');
526
+ *
527
+ * debuglog('hello from foo [%d]', 123);
528
+ * ```
529
+ *
530
+ * If this program is run with `NODE_DEBUG=foo` in the environment, then
531
+ * it will output something like:
532
+ *
533
+ * ```console
534
+ * FOO 3245: hello from foo [123]
535
+ * ```
536
+ *
537
+ * where `3245` is the process id. If it is not run with that
538
+ * environment variable set, then it will not print anything.
539
+ *
540
+ * The `section` supports wildcard also:
541
+ *
542
+ * ```js
543
+ * const util = require('util');
544
+ * const debuglog = util.debuglog('foo-bar');
545
+ *
546
+ * debuglog('hi there, it\'s foo-bar [%d]', 2333);
547
+ * ```
548
+ *
549
+ * if it is run with `NODE_DEBUG=foo*` in the environment, then it will output
550
+ * something like:
551
+ *
552
+ * ```console
553
+ * FOO-BAR 3257: hi there, it's foo-bar [2333]
554
+ * ```
555
+ *
556
+ * Multiple comma-separated `section` names may be specified in the `NODE_DEBUG`environment variable: `NODE_DEBUG=fs,net,tls`.
557
+ *
558
+ * The optional `callback` argument can be used to replace the logging function
559
+ * with a different function that doesn't have any initialization or
560
+ * unnecessary wrapping.
561
+ *
562
+ * ```js
563
+ * const util = require('util');
564
+ * let debuglog = util.debuglog('internals', (debug) => {
565
+ * // Replace with a logging function that optimizes out
566
+ * // testing if the section is enabled
567
+ * debuglog = debug;
568
+ * });
569
+ * ```
570
+ * @since v0.11.3
571
+ * @param section A string identifying the portion of the application for which the `debuglog` function is being created.
572
+ * @param callback A callback invoked the first time the logging function is called with a function argument that is a more optimized logging function.
573
+ * @return The logging function
574
+ */
575
+ export function debuglog(section: string, callback?: (fn: DebugLoggerFunction) => void): DebugLogger;
576
+ export const debug: typeof debuglog;
577
+ /**
578
+ * Returns `true` if the given `object` is a `Boolean`. Otherwise, returns `false`.
579
+ *
580
+ * ```js
581
+ * const util = require('util');
582
+ *
583
+ * util.isBoolean(1);
584
+ * // Returns: false
585
+ * util.isBoolean(0);
586
+ * // Returns: false
587
+ * util.isBoolean(false);
588
+ * // Returns: true
589
+ * ```
590
+ * @since v0.11.5
591
+ * @deprecated Since v4.0.0 - Use `typeof value === 'boolean'` instead.
592
+ */
593
+ export function isBoolean(object: unknown): object is boolean;
594
+ /**
595
+ * Returns `true` if the given `object` is a `Buffer`. Otherwise, returns `false`.
596
+ *
597
+ * ```js
598
+ * const util = require('util');
599
+ *
600
+ * util.isBuffer({ length: 0 });
601
+ * // Returns: false
602
+ * util.isBuffer([]);
603
+ * // Returns: false
604
+ * util.isBuffer(Buffer.from('hello world'));
605
+ * // Returns: true
606
+ * ```
607
+ * @since v0.11.5
608
+ * @deprecated Since v4.0.0 - Use `isBuffer` instead.
609
+ */
610
+ export function isBuffer(object: unknown): object is Buffer;
611
+ /**
612
+ * Returns `true` if the given `object` is a `Function`. Otherwise, returns`false`.
613
+ *
614
+ * ```js
615
+ * const util = require('util');
616
+ *
617
+ * function Foo() {}
618
+ * const Bar = () => {};
619
+ *
620
+ * util.isFunction({});
621
+ * // Returns: false
622
+ * util.isFunction(Foo);
623
+ * // Returns: true
624
+ * util.isFunction(Bar);
625
+ * // Returns: true
626
+ * ```
627
+ * @since v0.11.5
628
+ * @deprecated Since v4.0.0 - Use `typeof value === 'function'` instead.
629
+ */
630
+ export function isFunction(object: unknown): boolean;
631
+ /**
632
+ * Returns `true` if the given `object` is strictly `null`. Otherwise, returns`false`.
633
+ *
634
+ * ```js
635
+ * const util = require('util');
636
+ *
637
+ * util.isNull(0);
638
+ * // Returns: false
639
+ * util.isNull(undefined);
640
+ * // Returns: false
641
+ * util.isNull(null);
642
+ * // Returns: true
643
+ * ```
644
+ * @since v0.11.5
645
+ * @deprecated Since v4.0.0 - Use `value === null` instead.
646
+ */
647
+ export function isNull(object: unknown): object is null;
648
+ /**
649
+ * Returns `true` if the given `object` is `null` or `undefined`. Otherwise,
650
+ * returns `false`.
651
+ *
652
+ * ```js
653
+ * const util = require('util');
654
+ *
655
+ * util.isNullOrUndefined(0);
656
+ * // Returns: false
657
+ * util.isNullOrUndefined(undefined);
658
+ * // Returns: true
659
+ * util.isNullOrUndefined(null);
660
+ * // Returns: true
661
+ * ```
662
+ * @since v0.11.5
663
+ * @deprecated Since v4.0.0 - Use `value === undefined || value === null` instead.
664
+ */
665
+ export function isNullOrUndefined(object: unknown): object is null | undefined;
666
+ /**
667
+ * Returns `true` if the given `object` is a `Number`. Otherwise, returns `false`.
668
+ *
669
+ * ```js
670
+ * const util = require('util');
671
+ *
672
+ * util.isNumber(false);
673
+ * // Returns: false
674
+ * util.isNumber(Infinity);
675
+ * // Returns: true
676
+ * util.isNumber(0);
677
+ * // Returns: true
678
+ * util.isNumber(NaN);
679
+ * // Returns: true
680
+ * ```
681
+ * @since v0.11.5
682
+ * @deprecated Since v4.0.0 - Use `typeof value === 'number'` instead.
683
+ */
684
+ export function isNumber(object: unknown): object is number;
685
+ /**
686
+ * Returns `true` if the given `object` is strictly an `Object`**and** not a`Function` (even though functions are objects in JavaScript).
687
+ * Otherwise, returns `false`.
688
+ *
689
+ * ```js
690
+ * const util = require('util');
691
+ *
692
+ * util.isObject(5);
693
+ * // Returns: false
694
+ * util.isObject(null);
695
+ * // Returns: false
696
+ * util.isObject({});
697
+ * // Returns: true
698
+ * util.isObject(() => {});
699
+ * // Returns: false
700
+ * ```
701
+ * @since v0.11.5
702
+ * @deprecated Since v4.0.0 - Deprecated: Use `value !== null && typeof value === 'object'` instead.
703
+ */
704
+ export function isObject(object: unknown): boolean;
705
+ /**
706
+ * Returns `true` if the given `object` is a primitive type. Otherwise, returns`false`.
707
+ *
708
+ * ```js
709
+ * const util = require('util');
710
+ *
711
+ * util.isPrimitive(5);
712
+ * // Returns: true
713
+ * util.isPrimitive('foo');
714
+ * // Returns: true
715
+ * util.isPrimitive(false);
716
+ * // Returns: true
717
+ * util.isPrimitive(null);
718
+ * // Returns: true
719
+ * util.isPrimitive(undefined);
720
+ * // Returns: true
721
+ * util.isPrimitive({});
722
+ * // Returns: false
723
+ * util.isPrimitive(() => {});
724
+ * // Returns: false
725
+ * util.isPrimitive(/^$/);
726
+ * // Returns: false
727
+ * util.isPrimitive(new Date());
728
+ * // Returns: false
729
+ * ```
730
+ * @since v0.11.5
731
+ * @deprecated Since v4.0.0 - Use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead.
732
+ */
733
+ export function isPrimitive(object: unknown): boolean;
734
+ /**
735
+ * Returns `true` if the given `object` is a `string`. Otherwise, returns `false`.
736
+ *
737
+ * ```js
738
+ * const util = require('util');
739
+ *
740
+ * util.isString('');
741
+ * // Returns: true
742
+ * util.isString('foo');
743
+ * // Returns: true
744
+ * util.isString(String('foo'));
745
+ * // Returns: true
746
+ * util.isString(5);
747
+ * // Returns: false
748
+ * ```
749
+ * @since v0.11.5
750
+ * @deprecated Since v4.0.0 - Use `typeof value === 'string'` instead.
751
+ */
752
+ export function isString(object: unknown): object is string;
753
+ /**
754
+ * Returns `true` if the given `object` is a `Symbol`. Otherwise, returns `false`.
755
+ *
756
+ * ```js
757
+ * const util = require('util');
758
+ *
759
+ * util.isSymbol(5);
760
+ * // Returns: false
761
+ * util.isSymbol('foo');
762
+ * // Returns: false
763
+ * util.isSymbol(Symbol('foo'));
764
+ * // Returns: true
765
+ * ```
766
+ * @since v0.11.5
767
+ * @deprecated Since v4.0.0 - Use `typeof value === 'symbol'` instead.
768
+ */
769
+ export function isSymbol(object: unknown): object is symbol;
770
+ /**
771
+ * Returns `true` if the given `object` is `undefined`. Otherwise, returns `false`.
772
+ *
773
+ * ```js
774
+ * const util = require('util');
775
+ *
776
+ * const foo = undefined;
777
+ * util.isUndefined(5);
778
+ * // Returns: false
779
+ * util.isUndefined(foo);
780
+ * // Returns: true
781
+ * util.isUndefined(null);
782
+ * // Returns: false
783
+ * ```
784
+ * @since v0.11.5
785
+ * @deprecated Since v4.0.0 - Use `value === undefined` instead.
786
+ */
787
+ export function isUndefined(object: unknown): object is undefined;
788
+ /**
789
+ * The `util.deprecate()` method wraps `fn` (which may be a function or class) in
790
+ * such a way that it is marked as deprecated.
791
+ *
792
+ * ```js
793
+ * const util = require('util');
794
+ *
795
+ * exports.obsoleteFunction = util.deprecate(() => {
796
+ * // Do something here.
797
+ * }, 'obsoleteFunction() is deprecated. Use newShinyFunction() instead.');
798
+ * ```
799
+ *
800
+ * When called, `util.deprecate()` will return a function that will emit a`DeprecationWarning` using the `'warning'` event. The warning will
801
+ * be emitted and printed to `stderr` the first time the returned function is
802
+ * called. After the warning is emitted, the wrapped function is called without
803
+ * emitting a warning.
804
+ *
805
+ * If the same optional `code` is supplied in multiple calls to `util.deprecate()`,
806
+ * the warning will be emitted only once for that `code`.
807
+ *
808
+ * ```js
809
+ * const util = require('util');
810
+ *
811
+ * const fn1 = util.deprecate(someFunction, someMessage, 'DEP0001');
812
+ * const fn2 = util.deprecate(someOtherFunction, someOtherMessage, 'DEP0001');
813
+ * fn1(); // Emits a deprecation warning with code DEP0001
814
+ * fn2(); // Does not emit a deprecation warning because it has the same code
815
+ * ```
816
+ *
817
+ * If either the `--no-deprecation` or `--no-warnings` command-line flags are
818
+ * used, or if the `process.noDeprecation` property is set to `true`_prior_ to
819
+ * the first deprecation warning, the `util.deprecate()` method does nothing.
820
+ *
821
+ * If the `--trace-deprecation` or `--trace-warnings` command-line flags are set,
822
+ * or the `process.traceDeprecation` property is set to `true`, a warning and a
823
+ * stack trace are printed to `stderr` the first time the deprecated function is
824
+ * called.
825
+ *
826
+ * If the `--throw-deprecation` command-line flag is set, or the`process.throwDeprecation` property is set to `true`, then an exception will be
827
+ * thrown when the deprecated function is called.
828
+ *
829
+ * The `--throw-deprecation` command-line flag and `process.throwDeprecation`property take precedence over `--trace-deprecation` and`process.traceDeprecation`.
830
+ * @since v0.8.0
831
+ * @param fn The function that is being deprecated.
832
+ * @param msg A warning message to display when the deprecated function is invoked.
833
+ * @param code A deprecation code. See the `list of deprecated APIs` for a list of codes.
834
+ * @return The deprecated function wrapped to emit a warning.
835
+ */
836
+ export function deprecate<T extends Function>(fn: T, msg: string, code?: string): T;
837
+ /**
838
+ * Returns `true` if there is deep strict equality between `val1` and `val2`.
839
+ * Otherwise, returns `false`.
840
+ *
841
+ * See `assert.deepStrictEqual()` for more information about deep strict
842
+ * equality.
843
+ * @since v9.0.0
844
+ */
845
+ export function isDeepStrictEqual(val1: unknown, val2: unknown): boolean;
846
+ /**
847
+ * Returns `str` with any ANSI escape codes removed.
848
+ *
849
+ * ```js
850
+ * console.log(util.stripVTControlCharacters('\u001B[4mvalue\u001B[0m'));
851
+ * // Prints "value"
852
+ * ```
853
+ * @since v16.11.0
854
+ */
855
+ export function stripVTControlCharacters(str: string): string;
856
+ /**
857
+ * Takes an `async` function (or a function that returns a `Promise`) and returns a
858
+ * function following the error-first callback style, i.e. taking
859
+ * an `(err, value) => ...` callback as the last argument. In the callback, the
860
+ * first argument will be the rejection reason (or `null` if the `Promise`resolved), and the second argument will be the resolved value.
861
+ *
862
+ * ```js
863
+ * const util = require('util');
864
+ *
865
+ * async function fn() {
866
+ * return 'hello world';
867
+ * }
868
+ * const callbackFunction = util.callbackify(fn);
869
+ *
870
+ * callbackFunction((err, ret) => {
871
+ * if (err) throw err;
872
+ * console.log(ret);
873
+ * });
874
+ * ```
875
+ *
876
+ * Will print:
877
+ *
878
+ * ```text
879
+ * hello world
880
+ * ```
881
+ *
882
+ * The callback is executed asynchronously, and will have a limited stack trace.
883
+ * If the callback throws, the process will emit an `'uncaughtException'` event, and if not handled will exit.
884
+ *
885
+ * Since `null` has a special meaning as the first argument to a callback, if a
886
+ * wrapped function rejects a `Promise` with a falsy value as a reason, the value
887
+ * is wrapped in an `Error` with the original value stored in a field named`reason`.
888
+ *
889
+ * ```js
890
+ * function fn() {
891
+ * return Promise.reject(null);
892
+ * }
893
+ * const callbackFunction = util.callbackify(fn);
894
+ *
895
+ * callbackFunction((err, ret) => {
896
+ * // When the Promise was rejected with `null` it is wrapped with an Error and
897
+ * // the original value is stored in `reason`.
898
+ * err &#x26;&#x26; Object.hasOwn(err, 'reason') &#x26;&#x26; err.reason === null; // true
899
+ * });
900
+ * ```
901
+ * @since v8.2.0
902
+ * @param original An `async` function
903
+ * @return a callback style function
904
+ */
905
+ export function callbackify(fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void;
906
+ export function callbackify<TResult>(fn: () => Promise<TResult>): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
907
+ export function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void;
908
+ export function callbackify<T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
909
+ export function callbackify<T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void;
910
+ export function callbackify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2) => Promise<TResult>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
911
+ export function callbackify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void;
912
+ export function callbackify<T1, T2, T3, TResult>(
913
+ fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>
914
+ ): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
915
+ export function callbackify<T1, T2, T3, T4>(
916
+ fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>
917
+ ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void;
918
+ export function callbackify<T1, T2, T3, T4, TResult>(
919
+ fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>
920
+ ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
921
+ export function callbackify<T1, T2, T3, T4, T5>(
922
+ fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>
923
+ ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void;
924
+ export function callbackify<T1, T2, T3, T4, T5, TResult>(
925
+ fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>
926
+ ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
927
+ export function callbackify<T1, T2, T3, T4, T5, T6>(
928
+ fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>
929
+ ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void;
930
+ export function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
931
+ fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>
932
+ ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
933
+ export interface CustomPromisifyLegacy<TCustom extends Function> extends Function {
934
+ __promisify__: TCustom;
935
+ }
936
+ export interface CustomPromisifySymbol<TCustom extends Function> extends Function {
937
+ [promisify.custom]: TCustom;
938
+ }
939
+ export type CustomPromisify<TCustom extends Function> = CustomPromisifySymbol<TCustom> | CustomPromisifyLegacy<TCustom>;
940
+ /**
941
+ * Takes a function following the common error-first callback style, i.e. taking
942
+ * an `(err, value) => ...` callback as the last argument, and returns a version
943
+ * that returns promises.
944
+ *
945
+ * ```js
946
+ * const util = require('util');
947
+ * const fs = require('fs');
948
+ *
949
+ * const stat = util.promisify(fs.stat);
950
+ * stat('.').then((stats) => {
951
+ * // Do something with `stats`
952
+ * }).catch((error) => {
953
+ * // Handle the error.
954
+ * });
955
+ * ```
956
+ *
957
+ * Or, equivalently using `async function`s:
958
+ *
959
+ * ```js
960
+ * const util = require('util');
961
+ * const fs = require('fs');
962
+ *
963
+ * const stat = util.promisify(fs.stat);
964
+ *
965
+ * async function callStat() {
966
+ * const stats = await stat('.');
967
+ * console.log(`This directory is owned by ${stats.uid}`);
968
+ * }
969
+ * ```
970
+ *
971
+ * If there is an `original[util.promisify.custom]` property present, `promisify`will return its value, see `Custom promisified functions`.
972
+ *
973
+ * `promisify()` assumes that `original` is a function taking a callback as its
974
+ * final argument in all cases. If `original` is not a function, `promisify()`will throw an error. If `original` is a function but its last argument is not
975
+ * an error-first callback, it will still be passed an error-first
976
+ * callback as its last argument.
977
+ *
978
+ * Using `promisify()` on class methods or other methods that use `this` may not
979
+ * work as expected unless handled specially:
980
+ *
981
+ * ```js
982
+ * const util = require('util');
983
+ *
984
+ * class Foo {
985
+ * constructor() {
986
+ * this.a = 42;
987
+ * }
988
+ *
989
+ * bar(callback) {
990
+ * callback(null, this.a);
991
+ * }
992
+ * }
993
+ *
994
+ * const foo = new Foo();
995
+ *
996
+ * const naiveBar = util.promisify(foo.bar);
997
+ * // TypeError: Cannot read property 'a' of undefined
998
+ * // naiveBar().then(a => console.log(a));
999
+ *
1000
+ * naiveBar.call(foo).then((a) => console.log(a)); // '42'
1001
+ *
1002
+ * const bindBar = naiveBar.bind(foo);
1003
+ * bindBar().then((a) => console.log(a)); // '42'
1004
+ * ```
1005
+ * @since v8.0.0
1006
+ */
1007
+ export function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
1008
+ export function promisify<TResult>(fn: (callback: (err: any, result: TResult) => void) => void): () => Promise<TResult>;
1009
+ export function promisify(fn: (callback: (err?: any) => void) => void): () => Promise<void>;
1010
+ export function promisify<T1, TResult>(fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void): (arg1: T1) => Promise<TResult>;
1011
+ export function promisify<T1>(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise<void>;
1012
+ export function promisify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise<TResult>;
1013
+ export function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2) => Promise<void>;
1014
+ export function promisify<T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>;
1015
+ export function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>;
1016
+ export function promisify<T1, T2, T3, T4, TResult>(
1017
+ fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void
1018
+ ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
1019
+ export function promisify<T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>;
1020
+ export function promisify<T1, T2, T3, T4, T5, TResult>(
1021
+ fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void
1022
+ ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
1023
+ export function promisify<T1, T2, T3, T4, T5>(
1024
+ fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void
1025
+ ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
1026
+ export function promisify(fn: Function): Function;
1027
+ export namespace promisify {
1028
+ /**
1029
+ * That can be used to declare custom promisified variants of functions.
1030
+ */
1031
+ const custom: unique symbol;
1032
+ }
1033
+ /**
1034
+ * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextDecoder` API.
1035
+ *
1036
+ * ```js
1037
+ * const decoder = new TextDecoder();
1038
+ * const u8arr = new Uint8Array([72, 101, 108, 108, 111]);
1039
+ * console.log(decoder.decode(u8arr)); // Hello
1040
+ * ```
1041
+ * @since v8.3.0
1042
+ */
1043
+ export class TextDecoder {
1044
+ /**
1045
+ * The encoding supported by the `TextDecoder` instance.
1046
+ */
1047
+ readonly encoding: string;
1048
+ /**
1049
+ * The value will be `true` if decoding errors result in a `TypeError` being
1050
+ * thrown.
1051
+ */
1052
+ readonly fatal: boolean;
1053
+ /**
1054
+ * The value will be `true` if the decoding result will include the byte order
1055
+ * mark.
1056
+ */
1057
+ readonly ignoreBOM: boolean;
1058
+ constructor(
1059
+ encoding?: string,
1060
+ options?: {
1061
+ fatal?: boolean | undefined;
1062
+ ignoreBOM?: boolean | undefined;
1063
+ }
1064
+ );
1065
+ /**
1066
+ * Decodes the `input` and returns a string. If `options.stream` is `true`, any
1067
+ * incomplete byte sequences occurring at the end of the `input` are buffered
1068
+ * internally and emitted after the next call to `textDecoder.decode()`.
1069
+ *
1070
+ * If `textDecoder.fatal` is `true`, decoding errors that occur will result in a`TypeError` being thrown.
1071
+ * @param input An `ArrayBuffer`, `DataView` or `TypedArray` instance containing the encoded data.
1072
+ */
1073
+ decode(
1074
+ input?: NodeJS.ArrayBufferView | ArrayBuffer | null,
1075
+ options?: {
1076
+ stream?: boolean | undefined;
1077
+ }
1078
+ ): string;
1079
+ }
1080
+ export interface EncodeIntoResult {
1081
+ /**
1082
+ * The read Unicode code units of input.
1083
+ */
1084
+ read: number;
1085
+ /**
1086
+ * The written UTF-8 bytes of output.
1087
+ */
1088
+ written: number;
1089
+ }
1090
+ export { types };
1091
+
1092
+ //// TextEncoder/Decoder
1093
+ /**
1094
+ * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextEncoder` API. All
1095
+ * instances of `TextEncoder` only support UTF-8 encoding.
1096
+ *
1097
+ * ```js
1098
+ * const encoder = new TextEncoder();
1099
+ * const uint8array = encoder.encode('this is some data');
1100
+ * ```
1101
+ *
1102
+ * The `TextEncoder` class is also available on the global object.
1103
+ * @since v8.3.0
1104
+ */
1105
+ export class TextEncoder {
1106
+ /**
1107
+ * The encoding supported by the `TextEncoder` instance. Always set to `'utf-8'`.
1108
+ */
1109
+ readonly encoding: string;
1110
+ /**
1111
+ * UTF-8 encodes the `input` string and returns a `Uint8Array` containing the
1112
+ * encoded bytes.
1113
+ * @param [input='an empty string'] The text to encode.
1114
+ */
1115
+ encode(input?: string): Uint8Array;
1116
+ /**
1117
+ * UTF-8 encodes the `src` string to the `dest` Uint8Array and returns an object
1118
+ * containing the read Unicode code units and written UTF-8 bytes.
1119
+ *
1120
+ * ```js
1121
+ * const encoder = new TextEncoder();
1122
+ * const src = 'this is some data';
1123
+ * const dest = new Uint8Array(10);
1124
+ * const { read, written } = encoder.encodeInto(src, dest);
1125
+ * ```
1126
+ * @param src The text to encode.
1127
+ * @param dest The array to hold the encode result.
1128
+ */
1129
+ encodeInto(src: string, dest: Uint8Array): EncodeIntoResult;
1130
+ }
1131
+
1132
+ import { TextDecoder as _TextDecoder, TextEncoder as _TextEncoder } from 'util';
1133
+ global {
1134
+ /**
1135
+ * `TextDecoder` class is a global reference for `require('util').TextDecoder`
1136
+ * https://nodejs.org/api/globals.html#textdecoder
1137
+ * @since v11.0.0
1138
+ */
1139
+ var TextDecoder: typeof globalThis extends {
1140
+ onmessage: any;
1141
+ TextDecoder: infer TextDecoder;
1142
+ }
1143
+ ? TextDecoder
1144
+ : typeof _TextDecoder;
1145
+
1146
+ /**
1147
+ * `TextEncoder` class is a global reference for `require('util').TextEncoder`
1148
+ * https://nodejs.org/api/globals.html#textencoder
1149
+ * @since v11.0.0
1150
+ */
1151
+ var TextEncoder: typeof globalThis extends {
1152
+ onmessage: any;
1153
+ TextEncoder: infer TextEncoder;
1154
+ }
1155
+ ? TextEncoder
1156
+ : typeof _TextEncoder;
1157
+ }
1158
+
1159
+ //// parseArgs
1160
+ /**
1161
+ * Provides a high-level API for command-line argument parsing. Takes a
1162
+ * specification for the expected arguments and returns a structured object
1163
+ * with the parsed values and positionals.
1164
+ *
1165
+ * `config` provides arguments for parsing and configures the parser. It
1166
+ * supports the following properties:
1167
+ *
1168
+ * - `args` The array of argument strings. **Default:** `process.argv` with
1169
+ * `execPath` and `filename` removed.
1170
+ * - `options` Arguments known to the parser. Keys of `options` are the long
1171
+ * names of options and values are objects accepting the following properties:
1172
+ *
1173
+ * - `type` Type of argument, which must be either `boolean` (for options
1174
+ * which do not take values) or `string` (for options which do).
1175
+ * - `multiple` Whether this option can be provided multiple
1176
+ * times. If `true`, all values will be collected in an array. If
1177
+ * `false`, values for the option are last-wins. **Default:** `false`.
1178
+ * - `short` A single character alias for the option.
1179
+ * - `default` The default option value when it is not set by args. It
1180
+ * must be of the same type as the `type` property. When `multiple`
1181
+ * is `true`, it must be an array.
1182
+ *
1183
+ * - `strict`: Whether an error should be thrown when unknown arguments
1184
+ * are encountered, or when arguments are passed that do not match the
1185
+ * `type` configured in `options`. **Default:** `true`.
1186
+ * - `allowPositionals`: Whether this command accepts positional arguments.
1187
+ * **Default:** `false` if `strict` is `true`, otherwise `true`.
1188
+ * - `tokens`: Whether tokens {boolean} Return the parsed tokens. This is useful
1189
+ * for extending the built-in behavior, from adding additional checks through
1190
+ * to reprocessing the tokens in different ways.
1191
+ * **Default:** `false`.
1192
+ *
1193
+ * @returns The parsed command line arguments:
1194
+ *
1195
+ * - `values` A mapping of parsed option names with their string
1196
+ * or boolean values.
1197
+ * - `positionals` Positional arguments.
1198
+ * - `tokens` Detailed parse information (only if `tokens` was specified).
1199
+ *
1200
+ */
1201
+ export function parseArgs<T extends ParseArgsConfig>(config: T): ParsedResults<T>;
1202
+
1203
+ interface ParseArgsOptionConfig {
1204
+ type: 'string' | 'boolean';
1205
+ short?: string;
1206
+ multiple?: boolean;
1207
+ /**
1208
+ * @since v18.11.0
1209
+ */
1210
+ default?: string | boolean | string[] | boolean[];
1211
+ }
1212
+
1213
+ interface ParseArgsOptionsConfig {
1214
+ [longOption: string]: ParseArgsOptionConfig;
1215
+ }
1216
+
1217
+ export interface ParseArgsConfig {
1218
+ strict?: boolean;
1219
+ allowPositionals?: boolean;
1220
+ tokens?: boolean;
1221
+ options?: ParseArgsOptionsConfig;
1222
+ args?: string[];
1223
+ }
1224
+
1225
+ /*
1226
+ IfDefaultsTrue and IfDefaultsFalse are helpers to handle default values for missing boolean properties.
1227
+ TypeScript does not have exact types for objects: https://github.com/microsoft/TypeScript/issues/12936
1228
+ This means it is impossible to distinguish between "field X is definitely not present" and "field X may or may not be present".
1229
+ But we expect users to generally provide their config inline or `as const`, which means TS will always know whether a given field is present.
1230
+ So this helper treats "not definitely present" (i.e., not `extends boolean`) as being "definitely not present", i.e. it should have its default value.
1231
+ This is technically incorrect but is a much nicer UX for the common case.
1232
+ The IfDefaultsTrue version is for things which default to true; the IfDefaultsFalse version is for things which default to false.
1233
+ */
1234
+ type IfDefaultsTrue<T, IfTrue, IfFalse> = T extends true
1235
+ ? IfTrue
1236
+ : T extends false
1237
+ ? IfFalse
1238
+ : IfTrue;
1239
+
1240
+ // we put the `extends false` condition first here because `undefined` compares like `any` when `strictNullChecks: false`
1241
+ type IfDefaultsFalse<T, IfTrue, IfFalse> = T extends false
1242
+ ? IfFalse
1243
+ : T extends true
1244
+ ? IfTrue
1245
+ : IfFalse;
1246
+
1247
+ type ExtractOptionValue<T extends ParseArgsConfig, O extends ParseArgsOptionConfig> = IfDefaultsTrue<
1248
+ T['strict'],
1249
+ O['type'] extends 'string' ? string : O['type'] extends 'boolean' ? boolean : string | boolean,
1250
+ string | boolean
1251
+ >;
1252
+
1253
+ type ParsedValues<T extends ParseArgsConfig> =
1254
+ & IfDefaultsTrue<T['strict'], unknown, { [longOption: string]: undefined | string | boolean }>
1255
+ & (T['options'] extends ParseArgsOptionsConfig
1256
+ ? {
1257
+ -readonly [LongOption in keyof T['options']]: IfDefaultsFalse<
1258
+ T['options'][LongOption]['multiple'],
1259
+ undefined | Array<ExtractOptionValue<T, T['options'][LongOption]>>,
1260
+ undefined | ExtractOptionValue<T, T['options'][LongOption]>
1261
+ >;
1262
+ }
1263
+ : {});
1264
+
1265
+ type ParsedPositionals<T extends ParseArgsConfig> = IfDefaultsTrue<
1266
+ T['strict'],
1267
+ IfDefaultsFalse<T['allowPositionals'], string[], []>,
1268
+ IfDefaultsTrue<T['allowPositionals'], string[], []>
1269
+ >;
1270
+
1271
+ type PreciseTokenForOptions<
1272
+ K extends string,
1273
+ O extends ParseArgsOptionConfig,
1274
+ > = O['type'] extends 'string'
1275
+ ? {
1276
+ kind: 'option';
1277
+ index: number;
1278
+ name: K;
1279
+ rawName: string;
1280
+ value: string;
1281
+ inlineValue: boolean;
1282
+ }
1283
+ : O['type'] extends 'boolean'
1284
+ ? {
1285
+ kind: 'option';
1286
+ index: number;
1287
+ name: K;
1288
+ rawName: string;
1289
+ value: undefined;
1290
+ inlineValue: undefined;
1291
+ }
1292
+ : OptionToken & { name: K };
1293
+
1294
+ type TokenForOptions<
1295
+ T extends ParseArgsConfig,
1296
+ K extends keyof T['options'] = keyof T['options'],
1297
+ > = K extends unknown
1298
+ ? T['options'] extends ParseArgsOptionsConfig
1299
+ ? PreciseTokenForOptions<K & string, T['options'][K]>
1300
+ : OptionToken
1301
+ : never;
1302
+
1303
+ type ParsedOptionToken<T extends ParseArgsConfig> = IfDefaultsTrue<T['strict'], TokenForOptions<T>, OptionToken>;
1304
+
1305
+ type ParsedPositionalToken<T extends ParseArgsConfig> = IfDefaultsTrue<
1306
+ T['strict'],
1307
+ IfDefaultsFalse<T['allowPositionals'], { kind: 'positional'; index: number; value: string }, never>,
1308
+ IfDefaultsTrue<T['allowPositionals'], { kind: 'positional'; index: number; value: string }, never>
1309
+ >;
1310
+
1311
+ type ParsedTokens<T extends ParseArgsConfig> = Array<
1312
+ ParsedOptionToken<T> | ParsedPositionalToken<T> | { kind: 'option-terminator'; index: number }
1313
+ >;
1314
+
1315
+ type PreciseParsedResults<T extends ParseArgsConfig> = IfDefaultsFalse<
1316
+ T['tokens'],
1317
+ {
1318
+ values: ParsedValues<T>;
1319
+ positionals: ParsedPositionals<T>;
1320
+ tokens: ParsedTokens<T>;
1321
+ },
1322
+ {
1323
+ values: ParsedValues<T>;
1324
+ positionals: ParsedPositionals<T>;
1325
+ }
1326
+ >;
1327
+
1328
+ type OptionToken =
1329
+ | { kind: 'option'; index: number; name: string; rawName: string; value: string; inlineValue: boolean }
1330
+ | {
1331
+ kind: 'option';
1332
+ index: number;
1333
+ name: string;
1334
+ rawName: string;
1335
+ value: undefined;
1336
+ inlineValue: undefined;
1337
+ };
1338
+
1339
+ type Token =
1340
+ | OptionToken
1341
+ | { kind: 'positional'; index: number; value: string }
1342
+ | { kind: 'option-terminator'; index: number };
1343
+
1344
+ // If ParseArgsConfig extends T, then the user passed config constructed elsewhere.
1345
+ // So we can't rely on the `"not definitely present" implies "definitely not present"` assumption mentioned above.
1346
+ type ParsedResults<T extends ParseArgsConfig> = ParseArgsConfig extends T
1347
+ ? {
1348
+ values: { [longOption: string]: undefined | string | boolean | Array<string | boolean> };
1349
+ positionals: string[];
1350
+ tokens?: Token[];
1351
+ }
1352
+ : PreciseParsedResults<T>;
1353
+ }
1354
+ declare module 'util/types' {
1355
+ export * from 'util/types';
1356
+ }
1357
+ declare module 'util/types' {
1358
+ import { KeyObject, webcrypto } from 'node:crypto';
1359
+ /**
1360
+ * Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) or
1361
+ * [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance.
1362
+ *
1363
+ * See also `util.types.isArrayBuffer()` and `util.types.isSharedArrayBuffer()`.
1364
+ *
1365
+ * ```js
1366
+ * util.types.isAnyArrayBuffer(new ArrayBuffer()); // Returns true
1367
+ * util.types.isAnyArrayBuffer(new SharedArrayBuffer()); // Returns true
1368
+ * ```
1369
+ * @since v10.0.0
1370
+ */
1371
+ function isAnyArrayBuffer(object: unknown): object is ArrayBufferLike;
1372
+ /**
1373
+ * Returns `true` if the value is an `arguments` object.
1374
+ *
1375
+ * ```js
1376
+ * function foo() {
1377
+ * util.types.isArgumentsObject(arguments); // Returns true
1378
+ * }
1379
+ * ```
1380
+ * @since v10.0.0
1381
+ */
1382
+ function isArgumentsObject(object: unknown): object is IArguments;
1383
+ /**
1384
+ * Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instance.
1385
+ * This does _not_ include [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instances. Usually, it is
1386
+ * desirable to test for both; See `util.types.isAnyArrayBuffer()` for that.
1387
+ *
1388
+ * ```js
1389
+ * util.types.isArrayBuffer(new ArrayBuffer()); // Returns true
1390
+ * util.types.isArrayBuffer(new SharedArrayBuffer()); // Returns false
1391
+ * ```
1392
+ * @since v10.0.0
1393
+ */
1394
+ function isArrayBuffer(object: unknown): object is ArrayBuffer;
1395
+ /**
1396
+ * 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
1397
+ * array objects or [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView). Equivalent to
1398
+ * [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
1399
+ *
1400
+ * ```js
1401
+ * util.types.isArrayBufferView(new Int8Array()); // true
1402
+ * util.types.isArrayBufferView(Buffer.from('hello world')); // true
1403
+ * util.types.isArrayBufferView(new DataView(new ArrayBuffer(16))); // true
1404
+ * util.types.isArrayBufferView(new ArrayBuffer()); // false
1405
+ * ```
1406
+ * @since v10.0.0
1407
+ */
1408
+ function isArrayBufferView(object: unknown): object is NodeJS.ArrayBufferView;
1409
+ /**
1410
+ * Returns `true` if the value is an [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function).
1411
+ * This only reports back what the JavaScript engine is seeing;
1412
+ * in particular, the return value may not match the original source code if
1413
+ * a transpilation tool was used.
1414
+ *
1415
+ * ```js
1416
+ * util.types.isAsyncFunction(function foo() {}); // Returns false
1417
+ * util.types.isAsyncFunction(async function foo() {}); // Returns true
1418
+ * ```
1419
+ * @since v10.0.0
1420
+ */
1421
+ function isAsyncFunction(object: unknown): boolean;
1422
+ /**
1423
+ * Returns `true` if the value is a `BigInt64Array` instance.
1424
+ *
1425
+ * ```js
1426
+ * util.types.isBigInt64Array(new BigInt64Array()); // Returns true
1427
+ * util.types.isBigInt64Array(new BigUint64Array()); // Returns false
1428
+ * ```
1429
+ * @since v10.0.0
1430
+ */
1431
+ function isBigInt64Array(value: unknown): value is BigInt64Array;
1432
+ /**
1433
+ * Returns `true` if the value is a `BigUint64Array` instance.
1434
+ *
1435
+ * ```js
1436
+ * util.types.isBigUint64Array(new BigInt64Array()); // Returns false
1437
+ * util.types.isBigUint64Array(new BigUint64Array()); // Returns true
1438
+ * ```
1439
+ * @since v10.0.0
1440
+ */
1441
+ function isBigUint64Array(value: unknown): value is BigUint64Array;
1442
+ /**
1443
+ * Returns `true` if the value is a boolean object, e.g. created
1444
+ * by `new Boolean()`.
1445
+ *
1446
+ * ```js
1447
+ * util.types.isBooleanObject(false); // Returns false
1448
+ * util.types.isBooleanObject(true); // Returns false
1449
+ * util.types.isBooleanObject(new Boolean(false)); // Returns true
1450
+ * util.types.isBooleanObject(new Boolean(true)); // Returns true
1451
+ * util.types.isBooleanObject(Boolean(false)); // Returns false
1452
+ * util.types.isBooleanObject(Boolean(true)); // Returns false
1453
+ * ```
1454
+ * @since v10.0.0
1455
+ */
1456
+ function isBooleanObject(object: unknown): object is Boolean;
1457
+ /**
1458
+ * Returns `true` if the value is any boxed primitive object, e.g. created
1459
+ * by `new Boolean()`, `new String()` or `Object(Symbol())`.
1460
+ *
1461
+ * For example:
1462
+ *
1463
+ * ```js
1464
+ * util.types.isBoxedPrimitive(false); // Returns false
1465
+ * util.types.isBoxedPrimitive(new Boolean(false)); // Returns true
1466
+ * util.types.isBoxedPrimitive(Symbol('foo')); // Returns false
1467
+ * util.types.isBoxedPrimitive(Object(Symbol('foo'))); // Returns true
1468
+ * util.types.isBoxedPrimitive(Object(BigInt(5))); // Returns true
1469
+ * ```
1470
+ * @since v10.11.0
1471
+ */
1472
+ function isBoxedPrimitive(object: unknown): object is String | Number | BigInt | Boolean | Symbol;
1473
+ /**
1474
+ * Returns `true` if the value is a built-in [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) instance.
1475
+ *
1476
+ * ```js
1477
+ * const ab = new ArrayBuffer(20);
1478
+ * util.types.isDataView(new DataView(ab)); // Returns true
1479
+ * util.types.isDataView(new Float64Array()); // Returns false
1480
+ * ```
1481
+ *
1482
+ * See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
1483
+ * @since v10.0.0
1484
+ */
1485
+ function isDataView(object: unknown): object is DataView;
1486
+ /**
1487
+ * Returns `true` if the value is a built-in [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) instance.
1488
+ *
1489
+ * ```js
1490
+ * util.types.isDate(new Date()); // Returns true
1491
+ * ```
1492
+ * @since v10.0.0
1493
+ */
1494
+ function isDate(object: unknown): object is Date;
1495
+ /**
1496
+ * Returns `true` if the value is a native `External` value.
1497
+ *
1498
+ * A native `External` value is a special type of object that contains a
1499
+ * raw C++ pointer (`void*`) for access from native code, and has no other
1500
+ * properties. Such objects are created either by Node.js internals or native
1501
+ * addons. In JavaScript, they are [frozen](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze) objects with a`null` prototype.
1502
+ *
1503
+ * ```c
1504
+ * #include <js_native_api.h>
1505
+ * #include <stdlib.h>
1506
+ * napi_value result;
1507
+ * static napi_value MyNapi(napi_env env, napi_callback_info info) {
1508
+ * int* raw = (int*) malloc(1024);
1509
+ * napi_status status = napi_create_external(env, (void*) raw, NULL, NULL, &#x26;result);
1510
+ * if (status != napi_ok) {
1511
+ * napi_throw_error(env, NULL, "napi_create_external failed");
1512
+ * return NULL;
1513
+ * }
1514
+ * return result;
1515
+ * }
1516
+ * ...
1517
+ * DECLARE_NAPI_PROPERTY("myNapi", MyNapi)
1518
+ * ...
1519
+ * ```
1520
+ *
1521
+ * ```js
1522
+ * const native = require('napi_addon.node');
1523
+ * const data = native.myNapi();
1524
+ * util.types.isExternal(data); // returns true
1525
+ * util.types.isExternal(0); // returns false
1526
+ * util.types.isExternal(new String('foo')); // returns false
1527
+ * ```
1528
+ *
1529
+ * For further information on `napi_create_external`, refer to `napi_create_external()`.
1530
+ * @since v10.0.0
1531
+ */
1532
+ function isExternal(object: unknown): boolean;
1533
+ /**
1534
+ * Returns `true` if the value is a built-in [`Float32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array) instance.
1535
+ *
1536
+ * ```js
1537
+ * util.types.isFloat32Array(new ArrayBuffer()); // Returns false
1538
+ * util.types.isFloat32Array(new Float32Array()); // Returns true
1539
+ * util.types.isFloat32Array(new Float64Array()); // Returns false
1540
+ * ```
1541
+ * @since v10.0.0
1542
+ */
1543
+ function isFloat32Array(object: unknown): object is Float32Array;
1544
+ /**
1545
+ * Returns `true` if the value is a built-in [`Float64Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array) instance.
1546
+ *
1547
+ * ```js
1548
+ * util.types.isFloat64Array(new ArrayBuffer()); // Returns false
1549
+ * util.types.isFloat64Array(new Uint8Array()); // Returns false
1550
+ * util.types.isFloat64Array(new Float64Array()); // Returns true
1551
+ * ```
1552
+ * @since v10.0.0
1553
+ */
1554
+ function isFloat64Array(object: unknown): object is Float64Array;
1555
+ /**
1556
+ * Returns `true` if the value is a generator function.
1557
+ * This only reports back what the JavaScript engine is seeing;
1558
+ * in particular, the return value may not match the original source code if
1559
+ * a transpilation tool was used.
1560
+ *
1561
+ * ```js
1562
+ * util.types.isGeneratorFunction(function foo() {}); // Returns false
1563
+ * util.types.isGeneratorFunction(function* foo() {}); // Returns true
1564
+ * ```
1565
+ * @since v10.0.0
1566
+ */
1567
+ function isGeneratorFunction(object: unknown): object is GeneratorFunction;
1568
+ /**
1569
+ * Returns `true` if the value is a generator object as returned from a
1570
+ * built-in generator function.
1571
+ * This only reports back what the JavaScript engine is seeing;
1572
+ * in particular, the return value may not match the original source code if
1573
+ * a transpilation tool was used.
1574
+ *
1575
+ * ```js
1576
+ * function* foo() {}
1577
+ * const generator = foo();
1578
+ * util.types.isGeneratorObject(generator); // Returns true
1579
+ * ```
1580
+ * @since v10.0.0
1581
+ */
1582
+ function isGeneratorObject(object: unknown): object is Generator;
1583
+ /**
1584
+ * Returns `true` if the value is a built-in [`Int8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array) instance.
1585
+ *
1586
+ * ```js
1587
+ * util.types.isInt8Array(new ArrayBuffer()); // Returns false
1588
+ * util.types.isInt8Array(new Int8Array()); // Returns true
1589
+ * util.types.isInt8Array(new Float64Array()); // Returns false
1590
+ * ```
1591
+ * @since v10.0.0
1592
+ */
1593
+ function isInt8Array(object: unknown): object is Int8Array;
1594
+ /**
1595
+ * Returns `true` if the value is a built-in [`Int16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array) instance.
1596
+ *
1597
+ * ```js
1598
+ * util.types.isInt16Array(new ArrayBuffer()); // Returns false
1599
+ * util.types.isInt16Array(new Int16Array()); // Returns true
1600
+ * util.types.isInt16Array(new Float64Array()); // Returns false
1601
+ * ```
1602
+ * @since v10.0.0
1603
+ */
1604
+ function isInt16Array(object: unknown): object is Int16Array;
1605
+ /**
1606
+ * Returns `true` if the value is a built-in [`Int32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array) instance.
1607
+ *
1608
+ * ```js
1609
+ * util.types.isInt32Array(new ArrayBuffer()); // Returns false
1610
+ * util.types.isInt32Array(new Int32Array()); // Returns true
1611
+ * util.types.isInt32Array(new Float64Array()); // Returns false
1612
+ * ```
1613
+ * @since v10.0.0
1614
+ */
1615
+ function isInt32Array(object: unknown): object is Int32Array;
1616
+ /**
1617
+ * Returns `true` if the value is a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance.
1618
+ *
1619
+ * ```js
1620
+ * util.types.isMap(new Map()); // Returns true
1621
+ * ```
1622
+ * @since v10.0.0
1623
+ */
1624
+ function isMap<T>(object: T | {}): object is T extends ReadonlyMap<any, any> ? (unknown extends T ? never : ReadonlyMap<any, any>) : Map<unknown, unknown>;
1625
+ /**
1626
+ * 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.
1627
+ *
1628
+ * ```js
1629
+ * const map = new Map();
1630
+ * util.types.isMapIterator(map.keys()); // Returns true
1631
+ * util.types.isMapIterator(map.values()); // Returns true
1632
+ * util.types.isMapIterator(map.entries()); // Returns true
1633
+ * util.types.isMapIterator(map[Symbol.iterator]()); // Returns true
1634
+ * ```
1635
+ * @since v10.0.0
1636
+ */
1637
+ function isMapIterator(object: unknown): boolean;
1638
+ /**
1639
+ * Returns `true` if the value is an instance of a [Module Namespace Object](https://tc39.github.io/ecma262/#sec-module-namespace-exotic-objects).
1640
+ *
1641
+ * ```js
1642
+ * import * as ns from './a.js';
1643
+ *
1644
+ * util.types.isModuleNamespaceObject(ns); // Returns true
1645
+ * ```
1646
+ * @since v10.0.0
1647
+ */
1648
+ function isModuleNamespaceObject(value: unknown): boolean;
1649
+ /**
1650
+ * Returns `true` if the value is an instance of a built-in `Error` type.
1651
+ *
1652
+ * ```js
1653
+ * util.types.isNativeError(new Error()); // Returns true
1654
+ * util.types.isNativeError(new TypeError()); // Returns true
1655
+ * util.types.isNativeError(new RangeError()); // Returns true
1656
+ * ```
1657
+ * @since v10.0.0
1658
+ */
1659
+ function isNativeError(object: unknown): object is Error;
1660
+ /**
1661
+ * Returns `true` if the value is a number object, e.g. created
1662
+ * by `new Number()`.
1663
+ *
1664
+ * ```js
1665
+ * util.types.isNumberObject(0); // Returns false
1666
+ * util.types.isNumberObject(new Number(0)); // Returns true
1667
+ * ```
1668
+ * @since v10.0.0
1669
+ */
1670
+ function isNumberObject(object: unknown): object is Number;
1671
+ /**
1672
+ * Returns `true` if the value is a built-in [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
1673
+ *
1674
+ * ```js
1675
+ * util.types.isPromise(Promise.resolve(42)); // Returns true
1676
+ * ```
1677
+ * @since v10.0.0
1678
+ */
1679
+ function isPromise(object: unknown): object is Promise<unknown>;
1680
+ /**
1681
+ * Returns `true` if the value is a [`Proxy`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) instance.
1682
+ *
1683
+ * ```js
1684
+ * const target = {};
1685
+ * const proxy = new Proxy(target, {});
1686
+ * util.types.isProxy(target); // Returns false
1687
+ * util.types.isProxy(proxy); // Returns true
1688
+ * ```
1689
+ * @since v10.0.0
1690
+ */
1691
+ function isProxy(object: unknown): boolean;
1692
+ /**
1693
+ * Returns `true` if the value is a regular expression object.
1694
+ *
1695
+ * ```js
1696
+ * util.types.isRegExp(/abc/); // Returns true
1697
+ * util.types.isRegExp(new RegExp('abc')); // Returns true
1698
+ * ```
1699
+ * @since v10.0.0
1700
+ */
1701
+ function isRegExp(object: unknown): object is RegExp;
1702
+ /**
1703
+ * Returns `true` if the value is a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance.
1704
+ *
1705
+ * ```js
1706
+ * util.types.isSet(new Set()); // Returns true
1707
+ * ```
1708
+ * @since v10.0.0
1709
+ */
1710
+ function isSet<T>(object: T | {}): object is T extends ReadonlySet<any> ? (unknown extends T ? never : ReadonlySet<any>) : Set<unknown>;
1711
+ /**
1712
+ * 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.
1713
+ *
1714
+ * ```js
1715
+ * const set = new Set();
1716
+ * util.types.isSetIterator(set.keys()); // Returns true
1717
+ * util.types.isSetIterator(set.values()); // Returns true
1718
+ * util.types.isSetIterator(set.entries()); // Returns true
1719
+ * util.types.isSetIterator(set[Symbol.iterator]()); // Returns true
1720
+ * ```
1721
+ * @since v10.0.0
1722
+ */
1723
+ function isSetIterator(object: unknown): boolean;
1724
+ /**
1725
+ * Returns `true` if the value is a built-in [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance.
1726
+ * This does _not_ include [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instances. Usually, it is
1727
+ * desirable to test for both; See `util.types.isAnyArrayBuffer()` for that.
1728
+ *
1729
+ * ```js
1730
+ * util.types.isSharedArrayBuffer(new ArrayBuffer()); // Returns false
1731
+ * util.types.isSharedArrayBuffer(new SharedArrayBuffer()); // Returns true
1732
+ * ```
1733
+ * @since v10.0.0
1734
+ */
1735
+ function isSharedArrayBuffer(object: unknown): object is SharedArrayBuffer;
1736
+ /**
1737
+ * Returns `true` if the value is a string object, e.g. created
1738
+ * by `new String()`.
1739
+ *
1740
+ * ```js
1741
+ * util.types.isStringObject('foo'); // Returns false
1742
+ * util.types.isStringObject(new String('foo')); // Returns true
1743
+ * ```
1744
+ * @since v10.0.0
1745
+ */
1746
+ function isStringObject(object: unknown): object is String;
1747
+ /**
1748
+ * Returns `true` if the value is a symbol object, created
1749
+ * by calling `Object()` on a `Symbol` primitive.
1750
+ *
1751
+ * ```js
1752
+ * const symbol = Symbol('foo');
1753
+ * util.types.isSymbolObject(symbol); // Returns false
1754
+ * util.types.isSymbolObject(Object(symbol)); // Returns true
1755
+ * ```
1756
+ * @since v10.0.0
1757
+ */
1758
+ function isSymbolObject(object: unknown): object is Symbol;
1759
+ /**
1760
+ * Returns `true` if the value is a built-in [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) instance.
1761
+ *
1762
+ * ```js
1763
+ * util.types.isTypedArray(new ArrayBuffer()); // Returns false
1764
+ * util.types.isTypedArray(new Uint8Array()); // Returns true
1765
+ * util.types.isTypedArray(new Float64Array()); // Returns true
1766
+ * ```
1767
+ *
1768
+ * See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
1769
+ * @since v10.0.0
1770
+ */
1771
+ function isTypedArray(object: unknown): object is NodeJS.TypedArray;
1772
+ /**
1773
+ * Returns `true` if the value is a built-in [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) instance.
1774
+ *
1775
+ * ```js
1776
+ * util.types.isUint8Array(new ArrayBuffer()); // Returns false
1777
+ * util.types.isUint8Array(new Uint8Array()); // Returns true
1778
+ * util.types.isUint8Array(new Float64Array()); // Returns false
1779
+ * ```
1780
+ * @since v10.0.0
1781
+ */
1782
+ function isUint8Array(object: unknown): object is Uint8Array;
1783
+ /**
1784
+ * Returns `true` if the value is a built-in [`Uint8ClampedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray) instance.
1785
+ *
1786
+ * ```js
1787
+ * util.types.isUint8ClampedArray(new ArrayBuffer()); // Returns false
1788
+ * util.types.isUint8ClampedArray(new Uint8ClampedArray()); // Returns true
1789
+ * util.types.isUint8ClampedArray(new Float64Array()); // Returns false
1790
+ * ```
1791
+ * @since v10.0.0
1792
+ */
1793
+ function isUint8ClampedArray(object: unknown): object is Uint8ClampedArray;
1794
+ /**
1795
+ * Returns `true` if the value is a built-in [`Uint16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array) instance.
1796
+ *
1797
+ * ```js
1798
+ * util.types.isUint16Array(new ArrayBuffer()); // Returns false
1799
+ * util.types.isUint16Array(new Uint16Array()); // Returns true
1800
+ * util.types.isUint16Array(new Float64Array()); // Returns false
1801
+ * ```
1802
+ * @since v10.0.0
1803
+ */
1804
+ function isUint16Array(object: unknown): object is Uint16Array;
1805
+ /**
1806
+ * Returns `true` if the value is a built-in [`Uint32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array) instance.
1807
+ *
1808
+ * ```js
1809
+ * util.types.isUint32Array(new ArrayBuffer()); // Returns false
1810
+ * util.types.isUint32Array(new Uint32Array()); // Returns true
1811
+ * util.types.isUint32Array(new Float64Array()); // Returns false
1812
+ * ```
1813
+ * @since v10.0.0
1814
+ */
1815
+ function isUint32Array(object: unknown): object is Uint32Array;
1816
+ /**
1817
+ * Returns `true` if the value is a built-in [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) instance.
1818
+ *
1819
+ * ```js
1820
+ * util.types.isWeakMap(new WeakMap()); // Returns true
1821
+ * ```
1822
+ * @since v10.0.0
1823
+ */
1824
+ function isWeakMap(object: unknown): object is WeakMap<object, unknown>;
1825
+ /**
1826
+ * Returns `true` if the value is a built-in [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) instance.
1827
+ *
1828
+ * ```js
1829
+ * util.types.isWeakSet(new WeakSet()); // Returns true
1830
+ * ```
1831
+ * @since v10.0.0
1832
+ */
1833
+ function isWeakSet(object: unknown): object is WeakSet<object>;
1834
+ /**
1835
+ * Returns `true` if `value` is a `KeyObject`, `false` otherwise.
1836
+ * @since v16.2.0
1837
+ */
1838
+ function isKeyObject(object: unknown): object is KeyObject;
1839
+ /**
1840
+ * Returns `true` if `value` is a `CryptoKey`, `false` otherwise.
1841
+ * @since v16.2.0
1842
+ */
1843
+ function isCryptoKey(object: unknown): object is webcrypto.CryptoKey;
1844
+ }
1845
+ declare module 'node:util' {
1846
+ export * from 'util';
1847
+ }
1848
+ declare module 'node:util/types' {
1849
+ export * from 'util/types';
1850
+ }