cdk-ecr-deployment 0.0.76 → 0.0.79
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 +28 -25
- package/lambda/Dockerfile +25 -0
- package/lambda/install.js +64 -0
- package/lib/index.js +40 -23
- package/node_modules/@sindresorhus/is/dist/index.d.ts +225 -0
- package/node_modules/@sindresorhus/is/dist/index.js +427 -0
- package/node_modules/@sindresorhus/is/dist/types.d.ts +24 -0
- package/node_modules/@sindresorhus/is/dist/types.js +3 -0
- package/node_modules/@sindresorhus/is/license +9 -0
- package/node_modules/@sindresorhus/is/package.json +96 -0
- package/node_modules/@sindresorhus/is/readme.md +628 -0
- package/node_modules/@szmarczak/http-timer/LICENSE +21 -0
- package/node_modules/@szmarczak/http-timer/README.md +93 -0
- package/node_modules/@szmarczak/http-timer/dist/source/index.d.ts +32 -0
- package/node_modules/@szmarczak/http-timer/dist/source/index.js +126 -0
- package/node_modules/@szmarczak/http-timer/package.json +72 -0
- package/node_modules/@types/cacheable-request/LICENSE +21 -0
- package/node_modules/@types/cacheable-request/README.md +16 -0
- package/node_modules/@types/cacheable-request/index.d.ts +137 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +16 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/assert.d.ts +912 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/async_hooks.d.ts +497 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/buffer.d.ts +2142 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/child_process.d.ts +1365 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/cluster.d.ts +414 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/console.d.ts +412 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/constants.d.ts +18 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/crypto.d.ts +3307 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dgram.d.ts +545 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/diagnostics_channel.d.ts +128 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dns/promises.d.ts +357 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dns.d.ts +643 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/domain.d.ts +169 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/events.d.ts +623 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/fs/promises.d.ts +1004 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +3748 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.d.ts +284 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.global.d.ts +1 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/http.d.ts +1368 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/http2.d.ts +2100 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/https.d.ts +391 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +131 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/inspector.d.ts +2738 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/module.d.ts +114 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/net.d.ts +783 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/os.d.ts +455 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +230 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/path.d.ts +172 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/perf_hooks.d.ts +555 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/process.d.ts +1477 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/punycode.d.ts +117 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/querystring.d.ts +131 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/readline.d.ts +542 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/repl.d.ts +424 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/consumers.d.ts +24 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/promises.d.ts +42 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/web.d.ts +6 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream.d.ts +1249 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/timers/promises.d.ts +68 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/timers.d.ts +94 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/tls.d.ts +1019 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/trace_events.d.ts +161 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/tty.d.ts +204 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/url.d.ts +798 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/util.d.ts +1563 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/v8.d.ts +378 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/vm.d.ts +507 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/wasi.d.ts +158 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/worker_threads.d.ts +649 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/zlib.d.ts +517 -0
- package/node_modules/@types/cacheable-request/package.json +35 -0
- package/node_modules/@types/http-cache-semantics/LICENSE +21 -0
- package/node_modules/@types/http-cache-semantics/README.md +16 -0
- package/node_modules/@types/http-cache-semantics/index.d.ts +170 -0
- package/node_modules/@types/http-cache-semantics/package.json +25 -0
- package/node_modules/@types/keyv/LICENSE +21 -0
- package/node_modules/@types/keyv/README.md +16 -0
- package/node_modules/@types/keyv/index.d.ts +77 -0
- package/node_modules/@types/keyv/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@types/keyv/node_modules/@types/node/README.md +16 -0
- package/node_modules/@types/keyv/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/node_modules/@types/keyv/node_modules/@types/node/assert.d.ts +912 -0
- package/node_modules/@types/keyv/node_modules/@types/node/async_hooks.d.ts +497 -0
- package/node_modules/@types/keyv/node_modules/@types/node/buffer.d.ts +2142 -0
- package/node_modules/@types/keyv/node_modules/@types/node/child_process.d.ts +1365 -0
- package/node_modules/@types/keyv/node_modules/@types/node/cluster.d.ts +414 -0
- package/node_modules/@types/keyv/node_modules/@types/node/console.d.ts +412 -0
- package/node_modules/@types/keyv/node_modules/@types/node/constants.d.ts +18 -0
- package/node_modules/@types/keyv/node_modules/@types/node/crypto.d.ts +3307 -0
- package/node_modules/@types/keyv/node_modules/@types/node/dgram.d.ts +545 -0
- package/node_modules/@types/keyv/node_modules/@types/node/diagnostics_channel.d.ts +128 -0
- package/node_modules/@types/keyv/node_modules/@types/node/dns/promises.d.ts +357 -0
- package/node_modules/@types/keyv/node_modules/@types/node/dns.d.ts +643 -0
- package/node_modules/@types/keyv/node_modules/@types/node/domain.d.ts +169 -0
- package/node_modules/@types/keyv/node_modules/@types/node/events.d.ts +623 -0
- package/node_modules/@types/keyv/node_modules/@types/node/fs/promises.d.ts +1004 -0
- package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +3748 -0
- package/node_modules/@types/keyv/node_modules/@types/node/globals.d.ts +284 -0
- package/node_modules/@types/keyv/node_modules/@types/node/globals.global.d.ts +1 -0
- package/node_modules/@types/keyv/node_modules/@types/node/http.d.ts +1368 -0
- package/node_modules/@types/keyv/node_modules/@types/node/http2.d.ts +2100 -0
- package/node_modules/@types/keyv/node_modules/@types/node/https.d.ts +391 -0
- package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +131 -0
- package/node_modules/@types/keyv/node_modules/@types/node/inspector.d.ts +2738 -0
- package/node_modules/@types/keyv/node_modules/@types/node/module.d.ts +114 -0
- package/node_modules/@types/keyv/node_modules/@types/node/net.d.ts +783 -0
- package/node_modules/@types/keyv/node_modules/@types/node/os.d.ts +455 -0
- package/node_modules/@types/keyv/node_modules/@types/node/package.json +230 -0
- package/node_modules/@types/keyv/node_modules/@types/node/path.d.ts +172 -0
- package/node_modules/@types/keyv/node_modules/@types/node/perf_hooks.d.ts +555 -0
- package/node_modules/@types/keyv/node_modules/@types/node/process.d.ts +1477 -0
- package/node_modules/@types/keyv/node_modules/@types/node/punycode.d.ts +117 -0
- package/node_modules/@types/keyv/node_modules/@types/node/querystring.d.ts +131 -0
- package/node_modules/@types/keyv/node_modules/@types/node/readline.d.ts +542 -0
- package/node_modules/@types/keyv/node_modules/@types/node/repl.d.ts +424 -0
- package/node_modules/@types/keyv/node_modules/@types/node/stream/consumers.d.ts +24 -0
- package/node_modules/@types/keyv/node_modules/@types/node/stream/promises.d.ts +42 -0
- package/node_modules/@types/keyv/node_modules/@types/node/stream/web.d.ts +6 -0
- package/node_modules/@types/keyv/node_modules/@types/node/stream.d.ts +1249 -0
- package/node_modules/@types/keyv/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/node_modules/@types/keyv/node_modules/@types/node/timers/promises.d.ts +68 -0
- package/node_modules/@types/keyv/node_modules/@types/node/timers.d.ts +94 -0
- package/node_modules/@types/keyv/node_modules/@types/node/tls.d.ts +1019 -0
- package/node_modules/@types/keyv/node_modules/@types/node/trace_events.d.ts +161 -0
- package/node_modules/@types/keyv/node_modules/@types/node/tty.d.ts +204 -0
- package/node_modules/@types/keyv/node_modules/@types/node/url.d.ts +798 -0
- package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +1563 -0
- package/node_modules/@types/keyv/node_modules/@types/node/v8.d.ts +378 -0
- package/node_modules/@types/keyv/node_modules/@types/node/vm.d.ts +507 -0
- package/node_modules/@types/keyv/node_modules/@types/node/wasi.d.ts +158 -0
- package/node_modules/@types/keyv/node_modules/@types/node/worker_threads.d.ts +649 -0
- package/node_modules/@types/keyv/node_modules/@types/node/zlib.d.ts +517 -0
- package/node_modules/@types/keyv/package.json +32 -0
- package/node_modules/@types/responselike/LICENSE +21 -0
- package/node_modules/@types/responselike/README.md +16 -0
- package/node_modules/@types/responselike/index.d.ts +34 -0
- package/node_modules/@types/responselike/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@types/responselike/node_modules/@types/node/README.md +16 -0
- package/node_modules/@types/responselike/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/node_modules/@types/responselike/node_modules/@types/node/assert.d.ts +912 -0
- package/node_modules/@types/responselike/node_modules/@types/node/async_hooks.d.ts +497 -0
- package/node_modules/@types/responselike/node_modules/@types/node/buffer.d.ts +2142 -0
- package/node_modules/@types/responselike/node_modules/@types/node/child_process.d.ts +1365 -0
- package/node_modules/@types/responselike/node_modules/@types/node/cluster.d.ts +414 -0
- package/node_modules/@types/responselike/node_modules/@types/node/console.d.ts +412 -0
- package/node_modules/@types/responselike/node_modules/@types/node/constants.d.ts +18 -0
- package/node_modules/@types/responselike/node_modules/@types/node/crypto.d.ts +3307 -0
- package/node_modules/@types/responselike/node_modules/@types/node/dgram.d.ts +545 -0
- package/node_modules/@types/responselike/node_modules/@types/node/diagnostics_channel.d.ts +128 -0
- package/node_modules/@types/responselike/node_modules/@types/node/dns/promises.d.ts +357 -0
- package/node_modules/@types/responselike/node_modules/@types/node/dns.d.ts +643 -0
- package/node_modules/@types/responselike/node_modules/@types/node/domain.d.ts +169 -0
- package/node_modules/@types/responselike/node_modules/@types/node/events.d.ts +623 -0
- package/node_modules/@types/responselike/node_modules/@types/node/fs/promises.d.ts +1004 -0
- package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +3748 -0
- package/node_modules/@types/responselike/node_modules/@types/node/globals.d.ts +284 -0
- package/node_modules/@types/responselike/node_modules/@types/node/globals.global.d.ts +1 -0
- package/node_modules/@types/responselike/node_modules/@types/node/http.d.ts +1368 -0
- package/node_modules/@types/responselike/node_modules/@types/node/http2.d.ts +2100 -0
- package/node_modules/@types/responselike/node_modules/@types/node/https.d.ts +391 -0
- package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +131 -0
- package/node_modules/@types/responselike/node_modules/@types/node/inspector.d.ts +2738 -0
- package/node_modules/@types/responselike/node_modules/@types/node/module.d.ts +114 -0
- package/node_modules/@types/responselike/node_modules/@types/node/net.d.ts +783 -0
- package/node_modules/@types/responselike/node_modules/@types/node/os.d.ts +455 -0
- package/node_modules/@types/responselike/node_modules/@types/node/package.json +230 -0
- package/node_modules/@types/responselike/node_modules/@types/node/path.d.ts +172 -0
- package/node_modules/@types/responselike/node_modules/@types/node/perf_hooks.d.ts +555 -0
- package/node_modules/@types/responselike/node_modules/@types/node/process.d.ts +1477 -0
- package/node_modules/@types/responselike/node_modules/@types/node/punycode.d.ts +117 -0
- package/node_modules/@types/responselike/node_modules/@types/node/querystring.d.ts +131 -0
- package/node_modules/@types/responselike/node_modules/@types/node/readline.d.ts +542 -0
- package/node_modules/@types/responselike/node_modules/@types/node/repl.d.ts +424 -0
- package/node_modules/@types/responselike/node_modules/@types/node/stream/consumers.d.ts +24 -0
- package/node_modules/@types/responselike/node_modules/@types/node/stream/promises.d.ts +42 -0
- package/node_modules/@types/responselike/node_modules/@types/node/stream/web.d.ts +6 -0
- package/node_modules/@types/responselike/node_modules/@types/node/stream.d.ts +1249 -0
- package/node_modules/@types/responselike/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/node_modules/@types/responselike/node_modules/@types/node/timers/promises.d.ts +68 -0
- package/node_modules/@types/responselike/node_modules/@types/node/timers.d.ts +94 -0
- package/node_modules/@types/responselike/node_modules/@types/node/tls.d.ts +1019 -0
- package/node_modules/@types/responselike/node_modules/@types/node/trace_events.d.ts +161 -0
- package/node_modules/@types/responselike/node_modules/@types/node/tty.d.ts +204 -0
- package/node_modules/@types/responselike/node_modules/@types/node/url.d.ts +798 -0
- package/node_modules/@types/responselike/node_modules/@types/node/util.d.ts +1563 -0
- package/node_modules/@types/responselike/node_modules/@types/node/v8.d.ts +378 -0
- package/node_modules/@types/responselike/node_modules/@types/node/vm.d.ts +507 -0
- package/node_modules/@types/responselike/node_modules/@types/node/wasi.d.ts +158 -0
- package/node_modules/@types/responselike/node_modules/@types/node/worker_threads.d.ts +649 -0
- package/node_modules/@types/responselike/node_modules/@types/node/zlib.d.ts +517 -0
- package/node_modules/@types/responselike/package.json +25 -0
- package/node_modules/cacheable-lookup/LICENSE +21 -0
- package/node_modules/cacheable-lookup/README.md +240 -0
- package/node_modules/cacheable-lookup/index.d.ts +139 -0
- package/node_modules/cacheable-lookup/package.json +45 -0
- package/node_modules/cacheable-lookup/source/index.js +436 -0
- package/node_modules/cacheable-request/LICENSE +21 -0
- package/node_modules/cacheable-request/README.md +206 -0
- package/node_modules/cacheable-request/package.json +56 -0
- package/node_modules/cacheable-request/src/index.js +251 -0
- package/node_modules/clone-response/LICENSE +21 -0
- package/node_modules/clone-response/README.md +62 -0
- package/node_modules/clone-response/package.json +44 -0
- package/node_modules/clone-response/src/index.js +17 -0
- package/node_modules/decompress-response/index.d.ts +22 -0
- package/node_modules/decompress-response/index.js +58 -0
- package/node_modules/decompress-response/license +9 -0
- package/node_modules/decompress-response/node_modules/mimic-response/index.d.ts +17 -0
- package/node_modules/decompress-response/node_modules/mimic-response/index.js +77 -0
- package/node_modules/decompress-response/node_modules/mimic-response/license +9 -0
- package/node_modules/decompress-response/node_modules/mimic-response/package.json +42 -0
- package/node_modules/decompress-response/node_modules/mimic-response/readme.md +78 -0
- package/node_modules/decompress-response/package.json +56 -0
- package/node_modules/decompress-response/readme.md +48 -0
- package/node_modules/defer-to-connect/LICENSE +21 -0
- package/node_modules/defer-to-connect/README.md +38 -0
- package/node_modules/defer-to-connect/dist/source/index.d.ts +10 -0
- package/node_modules/defer-to-connect/dist/source/index.js +47 -0
- package/node_modules/defer-to-connect/package.json +71 -0
- package/node_modules/end-of-stream/LICENSE +21 -0
- package/node_modules/end-of-stream/README.md +54 -0
- package/node_modules/end-of-stream/index.js +94 -0
- package/node_modules/end-of-stream/package.json +37 -0
- package/node_modules/get-stream/buffer-stream.js +52 -0
- package/node_modules/get-stream/index.d.ts +108 -0
- package/node_modules/get-stream/index.js +60 -0
- package/node_modules/get-stream/license +9 -0
- package/node_modules/get-stream/package.json +50 -0
- package/node_modules/get-stream/readme.md +124 -0
- package/node_modules/got/dist/source/as-promise/create-rejection.d.ts +2 -0
- package/node_modules/got/dist/source/as-promise/create-rejection.js +30 -0
- package/node_modules/got/dist/source/as-promise/index.d.ts +3 -0
- package/node_modules/got/dist/source/as-promise/index.js +175 -0
- package/node_modules/got/dist/source/as-promise/normalize-arguments.d.ts +3 -0
- package/node_modules/got/dist/source/as-promise/normalize-arguments.js +78 -0
- package/node_modules/got/dist/source/as-promise/parse-body.d.ts +3 -0
- package/node_modules/got/dist/source/as-promise/parse-body.js +25 -0
- package/node_modules/got/dist/source/as-promise/types.d.ts +256 -0
- package/node_modules/got/dist/source/as-promise/types.js +40 -0
- package/node_modules/got/dist/source/core/calculate-retry-delay.d.ts +5 -0
- package/node_modules/got/dist/source/core/calculate-retry-delay.js +29 -0
- package/node_modules/got/dist/source/core/index.d.ts +1124 -0
- package/node_modules/got/dist/source/core/index.js +1491 -0
- package/node_modules/got/dist/source/core/utils/dns-ip-version.d.ts +5 -0
- package/node_modules/got/dist/source/core/utils/dns-ip-version.js +17 -0
- package/node_modules/got/dist/source/core/utils/get-body-size.d.ts +3 -0
- package/node_modules/got/dist/source/core/utils/get-body-size.js +32 -0
- package/node_modules/got/dist/source/core/utils/get-buffer.d.ts +4 -0
- package/node_modules/got/dist/source/core/utils/get-buffer.js +16 -0
- package/node_modules/got/dist/source/core/utils/is-form-data.d.ts +8 -0
- package/node_modules/got/dist/source/core/utils/is-form-data.js +4 -0
- package/node_modules/got/dist/source/core/utils/is-response-ok.d.ts +2 -0
- package/node_modules/got/dist/source/core/utils/is-response-ok.js +8 -0
- package/node_modules/got/dist/source/core/utils/options-to-url.d.ts +14 -0
- package/node_modules/got/dist/source/core/utils/options-to-url.js +53 -0
- package/node_modules/got/dist/source/core/utils/proxy-events.d.ts +3 -0
- package/node_modules/got/dist/source/core/utils/proxy-events.js +17 -0
- package/node_modules/got/dist/source/core/utils/timed-out.d.ts +29 -0
- package/node_modules/got/dist/source/core/utils/timed-out.js +121 -0
- package/node_modules/got/dist/source/core/utils/unhandle.d.ts +11 -0
- package/node_modules/got/dist/source/core/utils/unhandle.js +22 -0
- package/node_modules/got/dist/source/core/utils/url-to-options.d.ts +15 -0
- package/node_modules/got/dist/source/core/utils/url-to-options.js +24 -0
- package/node_modules/got/dist/source/core/utils/weakable-map.d.ts +8 -0
- package/node_modules/got/dist/source/core/utils/weakable-map.js +29 -0
- package/node_modules/got/dist/source/create.d.ts +5 -0
- package/node_modules/got/dist/source/create.js +240 -0
- package/node_modules/got/dist/source/index.d.ts +4 -0
- package/node_modules/got/dist/source/index.js +132 -0
- package/node_modules/got/dist/source/types.d.ts +342 -0
- package/node_modules/got/dist/source/types.js +2 -0
- package/node_modules/got/dist/source/utils/deep-freeze.d.ts +1 -0
- package/node_modules/got/dist/source/utils/deep-freeze.js +12 -0
- package/node_modules/got/dist/source/utils/deprecation-warning.d.ts +2 -0
- package/node_modules/got/dist/source/utils/deprecation-warning.js +13 -0
- package/node_modules/got/license +9 -0
- package/node_modules/got/package.json +130 -0
- package/node_modules/got/readme.md +2476 -0
- package/node_modules/http-cache-semantics/LICENSE +9 -0
- package/node_modules/http-cache-semantics/README.md +203 -0
- package/node_modules/http-cache-semantics/index.js +673 -0
- package/node_modules/http-cache-semantics/package.json +24 -0
- package/node_modules/http2-wrapper/LICENSE +21 -0
- package/node_modules/http2-wrapper/README.md +470 -0
- package/node_modules/http2-wrapper/package.json +54 -0
- package/node_modules/http2-wrapper/source/agent.js +670 -0
- package/node_modules/http2-wrapper/source/auto.js +149 -0
- package/node_modules/http2-wrapper/source/client-request.js +445 -0
- package/node_modules/http2-wrapper/source/incoming-message.js +58 -0
- package/node_modules/http2-wrapper/source/index.js +28 -0
- package/node_modules/http2-wrapper/source/utils/calculate-server-name.js +27 -0
- package/node_modules/http2-wrapper/source/utils/errors.js +45 -0
- package/node_modules/http2-wrapper/source/utils/is-request-pseudo-header.js +13 -0
- package/node_modules/http2-wrapper/source/utils/proxy-events.js +7 -0
- package/node_modules/http2-wrapper/source/utils/url-to-options.js +25 -0
- package/node_modules/json-buffer/.travis.yml +3 -0
- package/node_modules/json-buffer/LICENSE +22 -0
- package/node_modules/json-buffer/README.md +24 -0
- package/node_modules/json-buffer/index.js +58 -0
- package/node_modules/json-buffer/package.json +34 -0
- package/node_modules/json-buffer/test/index.js +63 -0
- package/node_modules/keyv/LICENSE +21 -0
- package/node_modules/keyv/README.md +288 -0
- package/node_modules/keyv/package.json +49 -0
- package/node_modules/keyv/src/index.js +111 -0
- package/node_modules/lowercase-keys/index.d.ts +16 -0
- package/node_modules/lowercase-keys/index.js +10 -0
- package/node_modules/lowercase-keys/license +9 -0
- package/node_modules/lowercase-keys/package.json +38 -0
- package/node_modules/lowercase-keys/readme.md +32 -0
- package/node_modules/mimic-response/index.js +32 -0
- package/node_modules/mimic-response/license +9 -0
- package/node_modules/mimic-response/package.json +37 -0
- package/node_modules/mimic-response/readme.md +54 -0
- package/node_modules/normalize-url/index.d.ts +267 -0
- package/node_modules/normalize-url/index.js +216 -0
- package/node_modules/normalize-url/license +9 -0
- package/node_modules/normalize-url/package.json +50 -0
- package/node_modules/normalize-url/readme.md +286 -0
- package/node_modules/once/LICENSE +15 -0
- package/node_modules/once/README.md +79 -0
- package/node_modules/once/once.js +42 -0
- package/node_modules/once/package.json +33 -0
- package/node_modules/p-cancelable/index.d.ts +176 -0
- package/node_modules/p-cancelable/index.js +111 -0
- package/node_modules/p-cancelable/license +9 -0
- package/node_modules/p-cancelable/package.json +49 -0
- package/node_modules/p-cancelable/readme.md +153 -0
- package/node_modules/pump/.travis.yml +5 -0
- package/node_modules/pump/LICENSE +21 -0
- package/node_modules/pump/README.md +65 -0
- package/node_modules/pump/index.js +82 -0
- package/node_modules/pump/package.json +24 -0
- package/node_modules/pump/test-browser.js +66 -0
- package/node_modules/pump/test-node.js +53 -0
- package/node_modules/quick-lru/index.d.ts +97 -0
- package/node_modules/quick-lru/index.js +123 -0
- package/node_modules/quick-lru/license +9 -0
- package/node_modules/quick-lru/package.json +43 -0
- package/node_modules/quick-lru/readme.md +111 -0
- package/node_modules/resolve-alpn/LICENSE +22 -0
- package/node_modules/resolve-alpn/README.md +60 -0
- package/node_modules/resolve-alpn/index.js +43 -0
- package/node_modules/resolve-alpn/package.json +34 -0
- package/node_modules/responselike/LICENSE +19 -0
- package/node_modules/responselike/README.md +77 -0
- package/node_modules/responselike/package.json +38 -0
- package/node_modules/responselike/src/index.js +34 -0
- package/node_modules/wrappy/LICENSE +15 -0
- package/node_modules/wrappy/README.md +36 -0
- package/node_modules/wrappy/package.json +29 -0
- package/node_modules/wrappy/wrappy.js +33 -0
- package/package.json +7 -4
|
@@ -0,0 +1,1563 @@
|
|
|
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/v16.9.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 a Map of all system error codes available from the 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 errorMap = util.getSystemErrorMap();
|
|
124
|
+
* const name = errorMap.get(err.errno);
|
|
125
|
+
* console.error(name); // ENOENT
|
|
126
|
+
* });
|
|
127
|
+
* ```
|
|
128
|
+
* @since v16.0.0
|
|
129
|
+
*/
|
|
130
|
+
export function getSystemErrorMap(): Map<number, [string, string]>;
|
|
131
|
+
/**
|
|
132
|
+
* The `util.log()` method prints the given `string` to `stdout` with an included
|
|
133
|
+
* timestamp.
|
|
134
|
+
*
|
|
135
|
+
* ```js
|
|
136
|
+
* const util = require('util');
|
|
137
|
+
*
|
|
138
|
+
* util.log('Timestamped message.');
|
|
139
|
+
* ```
|
|
140
|
+
* @since v0.3.0
|
|
141
|
+
* @deprecated Since v6.0.0 - Use a third party module instead.
|
|
142
|
+
*/
|
|
143
|
+
export function log(string: string): void;
|
|
144
|
+
/**
|
|
145
|
+
* Returns the `string` after replacing any surrogate code points
|
|
146
|
+
* (or equivalently, any unpaired surrogate code units) with the
|
|
147
|
+
* Unicode "replacement character" U+FFFD.
|
|
148
|
+
* @since v16.8.0
|
|
149
|
+
*/
|
|
150
|
+
export function toUSVString(string: string): string;
|
|
151
|
+
/**
|
|
152
|
+
* The `util.inspect()` method returns a string representation of `object` that is
|
|
153
|
+
* intended for debugging. The output of `util.inspect` may change at any time
|
|
154
|
+
* and should not be depended upon programmatically. Additional `options` may be
|
|
155
|
+
* passed that alter the result.`util.inspect()` will use the constructor's name and/or `@@toStringTag` to make
|
|
156
|
+
* an identifiable tag for an inspected value.
|
|
157
|
+
*
|
|
158
|
+
* ```js
|
|
159
|
+
* class Foo {
|
|
160
|
+
* get [Symbol.toStringTag]() {
|
|
161
|
+
* return 'bar';
|
|
162
|
+
* }
|
|
163
|
+
* }
|
|
164
|
+
*
|
|
165
|
+
* class Bar {}
|
|
166
|
+
*
|
|
167
|
+
* const baz = Object.create(null, { [Symbol.toStringTag]: { value: 'foo' } });
|
|
168
|
+
*
|
|
169
|
+
* util.inspect(new Foo()); // 'Foo [bar] {}'
|
|
170
|
+
* util.inspect(new Bar()); // 'Bar {}'
|
|
171
|
+
* util.inspect(baz); // '[foo] {}'
|
|
172
|
+
* ```
|
|
173
|
+
*
|
|
174
|
+
* Circular references point to their anchor by using a reference index:
|
|
175
|
+
*
|
|
176
|
+
* ```js
|
|
177
|
+
* const { inspect } = require('util');
|
|
178
|
+
*
|
|
179
|
+
* const obj = {};
|
|
180
|
+
* obj.a = [obj];
|
|
181
|
+
* obj.b = {};
|
|
182
|
+
* obj.b.inner = obj.b;
|
|
183
|
+
* obj.b.obj = obj;
|
|
184
|
+
*
|
|
185
|
+
* console.log(inspect(obj));
|
|
186
|
+
* // <ref *1> {
|
|
187
|
+
* // a: [ [Circular *1] ],
|
|
188
|
+
* // b: <ref *2> { inner: [Circular *2], obj: [Circular *1] }
|
|
189
|
+
* // }
|
|
190
|
+
* ```
|
|
191
|
+
*
|
|
192
|
+
* The following example inspects all properties of the `util` object:
|
|
193
|
+
*
|
|
194
|
+
* ```js
|
|
195
|
+
* const util = require('util');
|
|
196
|
+
*
|
|
197
|
+
* console.log(util.inspect(util, { showHidden: true, depth: null }));
|
|
198
|
+
* ```
|
|
199
|
+
*
|
|
200
|
+
* The following example highlights the effect of the `compact` option:
|
|
201
|
+
*
|
|
202
|
+
* ```js
|
|
203
|
+
* const util = require('util');
|
|
204
|
+
*
|
|
205
|
+
* const o = {
|
|
206
|
+
* a: [1, 2, [[
|
|
207
|
+
* 'Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit, sed do ' +
|
|
208
|
+
* 'eiusmod \ntempor incididunt ut labore et dolore magna aliqua.',
|
|
209
|
+
* 'test',
|
|
210
|
+
* 'foo']], 4],
|
|
211
|
+
* b: new Map([['za', 1], ['zb', 'test']])
|
|
212
|
+
* };
|
|
213
|
+
* console.log(util.inspect(o, { compact: true, depth: 5, breakLength: 80 }));
|
|
214
|
+
*
|
|
215
|
+
* // { a:
|
|
216
|
+
* // [ 1,
|
|
217
|
+
* // 2,
|
|
218
|
+
* // [ [ 'Lorem ipsum dolor sit amet,\nconsectetur [...]', // A long line
|
|
219
|
+
* // 'test',
|
|
220
|
+
* // 'foo' ] ],
|
|
221
|
+
* // 4 ],
|
|
222
|
+
* // b: Map(2) { 'za' => 1, 'zb' => 'test' } }
|
|
223
|
+
*
|
|
224
|
+
* // Setting `compact` to false or an integer creates more reader friendly output.
|
|
225
|
+
* console.log(util.inspect(o, { compact: false, depth: 5, breakLength: 80 }));
|
|
226
|
+
*
|
|
227
|
+
* // {
|
|
228
|
+
* // a: [
|
|
229
|
+
* // 1,
|
|
230
|
+
* // 2,
|
|
231
|
+
* // [
|
|
232
|
+
* // [
|
|
233
|
+
* // 'Lorem ipsum dolor sit amet,\n' +
|
|
234
|
+
* // 'consectetur adipiscing elit, sed do eiusmod \n' +
|
|
235
|
+
* // 'tempor incididunt ut labore et dolore magna aliqua.',
|
|
236
|
+
* // 'test',
|
|
237
|
+
* // 'foo'
|
|
238
|
+
* // ]
|
|
239
|
+
* // ],
|
|
240
|
+
* // 4
|
|
241
|
+
* // ],
|
|
242
|
+
* // b: Map(2) {
|
|
243
|
+
* // 'za' => 1,
|
|
244
|
+
* // 'zb' => 'test'
|
|
245
|
+
* // }
|
|
246
|
+
* // }
|
|
247
|
+
*
|
|
248
|
+
* // Setting `breakLength` to e.g. 150 will print the "Lorem ipsum" text in a
|
|
249
|
+
* // single line.
|
|
250
|
+
* ```
|
|
251
|
+
*
|
|
252
|
+
* The `showHidden` option allows [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) and
|
|
253
|
+
* [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) entries to be
|
|
254
|
+
* inspected. If there are more entries than `maxArrayLength`, there is no
|
|
255
|
+
* 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
|
|
256
|
+
* result in different output. Furthermore, entries
|
|
257
|
+
* with no remaining strong references may be garbage collected at any time.
|
|
258
|
+
*
|
|
259
|
+
* ```js
|
|
260
|
+
* const { inspect } = require('util');
|
|
261
|
+
*
|
|
262
|
+
* const obj = { a: 1 };
|
|
263
|
+
* const obj2 = { b: 2 };
|
|
264
|
+
* const weakSet = new WeakSet([obj, obj2]);
|
|
265
|
+
*
|
|
266
|
+
* console.log(inspect(weakSet, { showHidden: true }));
|
|
267
|
+
* // WeakSet { { a: 1 }, { b: 2 } }
|
|
268
|
+
* ```
|
|
269
|
+
*
|
|
270
|
+
* The `sorted` option ensures that an object's property insertion order does not
|
|
271
|
+
* impact the result of `util.inspect()`.
|
|
272
|
+
*
|
|
273
|
+
* ```js
|
|
274
|
+
* const { inspect } = require('util');
|
|
275
|
+
* const assert = require('assert');
|
|
276
|
+
*
|
|
277
|
+
* const o1 = {
|
|
278
|
+
* b: [2, 3, 1],
|
|
279
|
+
* a: '`a` comes before `b`',
|
|
280
|
+
* c: new Set([2, 3, 1])
|
|
281
|
+
* };
|
|
282
|
+
* console.log(inspect(o1, { sorted: true }));
|
|
283
|
+
* // { a: '`a` comes before `b`', b: [ 2, 3, 1 ], c: Set(3) { 1, 2, 3 } }
|
|
284
|
+
* console.log(inspect(o1, { sorted: (a, b) => b.localeCompare(a) }));
|
|
285
|
+
* // { c: Set(3) { 3, 2, 1 }, b: [ 2, 3, 1 ], a: '`a` comes before `b`' }
|
|
286
|
+
*
|
|
287
|
+
* const o2 = {
|
|
288
|
+
* c: new Set([2, 1, 3]),
|
|
289
|
+
* a: '`a` comes before `b`',
|
|
290
|
+
* b: [2, 3, 1]
|
|
291
|
+
* };
|
|
292
|
+
* assert.strict.equal(
|
|
293
|
+
* inspect(o1, { sorted: true }),
|
|
294
|
+
* inspect(o2, { sorted: true })
|
|
295
|
+
* );
|
|
296
|
+
* ```
|
|
297
|
+
*
|
|
298
|
+
* `util.inspect()` is a synchronous method intended for debugging. Its maximum
|
|
299
|
+
* output length is approximately 128 MB. Inputs that result in longer output will
|
|
300
|
+
* be truncated.
|
|
301
|
+
* @since v0.3.0
|
|
302
|
+
* @param object Any JavaScript primitive or `Object`.
|
|
303
|
+
* @return The representation of `object`.
|
|
304
|
+
*/
|
|
305
|
+
export function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
|
|
306
|
+
export function inspect(object: any, options: InspectOptions): string;
|
|
307
|
+
export namespace inspect {
|
|
308
|
+
let colors: NodeJS.Dict<[number, number]>;
|
|
309
|
+
let styles: {
|
|
310
|
+
[K in Style]: string;
|
|
311
|
+
};
|
|
312
|
+
let defaultOptions: InspectOptions;
|
|
313
|
+
/**
|
|
314
|
+
* Allows changing inspect settings from the repl.
|
|
315
|
+
*/
|
|
316
|
+
let replDefaults: InspectOptions;
|
|
317
|
+
const custom: unique symbol;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Alias for [`Array.isArray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray).
|
|
321
|
+
*
|
|
322
|
+
* Returns `true` if the given `object` is an `Array`. Otherwise, returns `false`.
|
|
323
|
+
*
|
|
324
|
+
* ```js
|
|
325
|
+
* const util = require('util');
|
|
326
|
+
*
|
|
327
|
+
* util.isArray([]);
|
|
328
|
+
* // Returns: true
|
|
329
|
+
* util.isArray(new Array());
|
|
330
|
+
* // Returns: true
|
|
331
|
+
* util.isArray({});
|
|
332
|
+
* // Returns: false
|
|
333
|
+
* ```
|
|
334
|
+
* @since v0.6.0
|
|
335
|
+
* @deprecated Since v4.0.0 - Use `isArray` instead.
|
|
336
|
+
*/
|
|
337
|
+
export function isArray(object: unknown): object is unknown[];
|
|
338
|
+
/**
|
|
339
|
+
* Returns `true` if the given `object` is a `RegExp`. Otherwise, returns `false`.
|
|
340
|
+
*
|
|
341
|
+
* ```js
|
|
342
|
+
* const util = require('util');
|
|
343
|
+
*
|
|
344
|
+
* util.isRegExp(/some regexp/);
|
|
345
|
+
* // Returns: true
|
|
346
|
+
* util.isRegExp(new RegExp('another regexp'));
|
|
347
|
+
* // Returns: true
|
|
348
|
+
* util.isRegExp({});
|
|
349
|
+
* // Returns: false
|
|
350
|
+
* ```
|
|
351
|
+
* @since v0.6.0
|
|
352
|
+
* @deprecated Since v4.0.0 - Deprecated
|
|
353
|
+
*/
|
|
354
|
+
export function isRegExp(object: unknown): object is RegExp;
|
|
355
|
+
/**
|
|
356
|
+
* Returns `true` if the given `object` is a `Date`. Otherwise, returns `false`.
|
|
357
|
+
*
|
|
358
|
+
* ```js
|
|
359
|
+
* const util = require('util');
|
|
360
|
+
*
|
|
361
|
+
* util.isDate(new Date());
|
|
362
|
+
* // Returns: true
|
|
363
|
+
* util.isDate(Date());
|
|
364
|
+
* // false (without 'new' returns a String)
|
|
365
|
+
* util.isDate({});
|
|
366
|
+
* // Returns: false
|
|
367
|
+
* ```
|
|
368
|
+
* @since v0.6.0
|
|
369
|
+
* @deprecated Since v4.0.0 - Use {@link types.isDate} instead.
|
|
370
|
+
*/
|
|
371
|
+
export function isDate(object: unknown): object is Date;
|
|
372
|
+
/**
|
|
373
|
+
* Returns `true` if the given `object` is an `Error`. Otherwise, returns`false`.
|
|
374
|
+
*
|
|
375
|
+
* ```js
|
|
376
|
+
* const util = require('util');
|
|
377
|
+
*
|
|
378
|
+
* util.isError(new Error());
|
|
379
|
+
* // Returns: true
|
|
380
|
+
* util.isError(new TypeError());
|
|
381
|
+
* // Returns: true
|
|
382
|
+
* util.isError({ name: 'Error', message: 'an error occurred' });
|
|
383
|
+
* // Returns: false
|
|
384
|
+
* ```
|
|
385
|
+
*
|
|
386
|
+
* This method relies on `Object.prototype.toString()` behavior. It is
|
|
387
|
+
* possible to obtain an incorrect result when the `object` argument manipulates`@@toStringTag`.
|
|
388
|
+
*
|
|
389
|
+
* ```js
|
|
390
|
+
* const util = require('util');
|
|
391
|
+
* const obj = { name: 'Error', message: 'an error occurred' };
|
|
392
|
+
*
|
|
393
|
+
* util.isError(obj);
|
|
394
|
+
* // Returns: false
|
|
395
|
+
* obj[Symbol.toStringTag] = 'Error';
|
|
396
|
+
* util.isError(obj);
|
|
397
|
+
* // Returns: true
|
|
398
|
+
* ```
|
|
399
|
+
* @since v0.6.0
|
|
400
|
+
* @deprecated Since v4.0.0 - Use {@link types.isNativeError} instead.
|
|
401
|
+
*/
|
|
402
|
+
export function isError(object: unknown): object is Error;
|
|
403
|
+
/**
|
|
404
|
+
* Usage of `util.inherits()` is discouraged. Please use the ES6 `class` and`extends` keywords to get language level inheritance support. Also note
|
|
405
|
+
* that the two styles are [semantically incompatible](https://github.com/nodejs/node/issues/4179).
|
|
406
|
+
*
|
|
407
|
+
* Inherit the prototype methods from one [constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor) into another. The
|
|
408
|
+
* prototype of `constructor` will be set to a new object created from`superConstructor`.
|
|
409
|
+
*
|
|
410
|
+
* This mainly adds some input validation on top of`Object.setPrototypeOf(constructor.prototype, superConstructor.prototype)`.
|
|
411
|
+
* As an additional convenience, `superConstructor` will be accessible
|
|
412
|
+
* through the `constructor.super_` property.
|
|
413
|
+
*
|
|
414
|
+
* ```js
|
|
415
|
+
* const util = require('util');
|
|
416
|
+
* const EventEmitter = require('events');
|
|
417
|
+
*
|
|
418
|
+
* function MyStream() {
|
|
419
|
+
* EventEmitter.call(this);
|
|
420
|
+
* }
|
|
421
|
+
*
|
|
422
|
+
* util.inherits(MyStream, EventEmitter);
|
|
423
|
+
*
|
|
424
|
+
* MyStream.prototype.write = function(data) {
|
|
425
|
+
* this.emit('data', data);
|
|
426
|
+
* };
|
|
427
|
+
*
|
|
428
|
+
* const stream = new MyStream();
|
|
429
|
+
*
|
|
430
|
+
* console.log(stream instanceof EventEmitter); // true
|
|
431
|
+
* console.log(MyStream.super_ === EventEmitter); // true
|
|
432
|
+
*
|
|
433
|
+
* stream.on('data', (data) => {
|
|
434
|
+
* console.log(`Received data: "${data}"`);
|
|
435
|
+
* });
|
|
436
|
+
* stream.write('It works!'); // Received data: "It works!"
|
|
437
|
+
* ```
|
|
438
|
+
*
|
|
439
|
+
* ES6 example using `class` and `extends`:
|
|
440
|
+
*
|
|
441
|
+
* ```js
|
|
442
|
+
* const EventEmitter = require('events');
|
|
443
|
+
*
|
|
444
|
+
* class MyStream extends EventEmitter {
|
|
445
|
+
* write(data) {
|
|
446
|
+
* this.emit('data', data);
|
|
447
|
+
* }
|
|
448
|
+
* }
|
|
449
|
+
*
|
|
450
|
+
* const stream = new MyStream();
|
|
451
|
+
*
|
|
452
|
+
* stream.on('data', (data) => {
|
|
453
|
+
* console.log(`Received data: "${data}"`);
|
|
454
|
+
* });
|
|
455
|
+
* stream.write('With ES6');
|
|
456
|
+
* ```
|
|
457
|
+
* @since v0.3.0
|
|
458
|
+
* @deprecated Legacy: Use ES2015 class syntax and `extends` keyword instead.
|
|
459
|
+
*/
|
|
460
|
+
export function inherits(constructor: unknown, superConstructor: unknown): void;
|
|
461
|
+
export type DebugLoggerFunction = (msg: string, ...param: unknown[]) => void;
|
|
462
|
+
export interface DebugLogger extends DebugLoggerFunction {
|
|
463
|
+
enabled: boolean;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* The `util.debuglog()` method is used to create a function that conditionally
|
|
467
|
+
* 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
|
|
468
|
+
* environment variable, then the returned function operates similar to `console.error()`. If not, then the returned function is a no-op.
|
|
469
|
+
*
|
|
470
|
+
* ```js
|
|
471
|
+
* const util = require('util');
|
|
472
|
+
* const debuglog = util.debuglog('foo');
|
|
473
|
+
*
|
|
474
|
+
* debuglog('hello from foo [%d]', 123);
|
|
475
|
+
* ```
|
|
476
|
+
*
|
|
477
|
+
* If this program is run with `NODE_DEBUG=foo` in the environment, then
|
|
478
|
+
* it will output something like:
|
|
479
|
+
*
|
|
480
|
+
* ```console
|
|
481
|
+
* FOO 3245: hello from foo [123]
|
|
482
|
+
* ```
|
|
483
|
+
*
|
|
484
|
+
* where `3245` is the process id. If it is not run with that
|
|
485
|
+
* environment variable set, then it will not print anything.
|
|
486
|
+
*
|
|
487
|
+
* The `section` supports wildcard also:
|
|
488
|
+
*
|
|
489
|
+
* ```js
|
|
490
|
+
* const util = require('util');
|
|
491
|
+
* const debuglog = util.debuglog('foo-bar');
|
|
492
|
+
*
|
|
493
|
+
* debuglog('hi there, it\'s foo-bar [%d]', 2333);
|
|
494
|
+
* ```
|
|
495
|
+
*
|
|
496
|
+
* if it is run with `NODE_DEBUG=foo*` in the environment, then it will output
|
|
497
|
+
* something like:
|
|
498
|
+
*
|
|
499
|
+
* ```console
|
|
500
|
+
* FOO-BAR 3257: hi there, it's foo-bar [2333]
|
|
501
|
+
* ```
|
|
502
|
+
*
|
|
503
|
+
* Multiple comma-separated `section` names may be specified in the `NODE_DEBUG`environment variable: `NODE_DEBUG=fs,net,tls`.
|
|
504
|
+
*
|
|
505
|
+
* The optional `callback` argument can be used to replace the logging function
|
|
506
|
+
* with a different function that doesn't have any initialization or
|
|
507
|
+
* unnecessary wrapping.
|
|
508
|
+
*
|
|
509
|
+
* ```js
|
|
510
|
+
* const util = require('util');
|
|
511
|
+
* let debuglog = util.debuglog('internals', (debug) => {
|
|
512
|
+
* // Replace with a logging function that optimizes out
|
|
513
|
+
* // testing if the section is enabled
|
|
514
|
+
* debuglog = debug;
|
|
515
|
+
* });
|
|
516
|
+
* ```
|
|
517
|
+
* @since v0.11.3
|
|
518
|
+
* @param section A string identifying the portion of the application for which the `debuglog` function is being created.
|
|
519
|
+
* @param callback A callback invoked the first time the logging function is called with a function argument that is a more optimized logging function.
|
|
520
|
+
* @return The logging function
|
|
521
|
+
*/
|
|
522
|
+
export function debuglog(section: string, callback?: (fn: DebugLoggerFunction) => void): DebugLogger;
|
|
523
|
+
/**
|
|
524
|
+
* Returns `true` if the given `object` is a `Boolean`. Otherwise, returns `false`.
|
|
525
|
+
*
|
|
526
|
+
* ```js
|
|
527
|
+
* const util = require('util');
|
|
528
|
+
*
|
|
529
|
+
* util.isBoolean(1);
|
|
530
|
+
* // Returns: false
|
|
531
|
+
* util.isBoolean(0);
|
|
532
|
+
* // Returns: false
|
|
533
|
+
* util.isBoolean(false);
|
|
534
|
+
* // Returns: true
|
|
535
|
+
* ```
|
|
536
|
+
* @since v0.11.5
|
|
537
|
+
* @deprecated Since v4.0.0 - Use `typeof value === 'boolean'` instead.
|
|
538
|
+
*/
|
|
539
|
+
export function isBoolean(object: unknown): object is boolean;
|
|
540
|
+
/**
|
|
541
|
+
* Returns `true` if the given `object` is a `Buffer`. Otherwise, returns `false`.
|
|
542
|
+
*
|
|
543
|
+
* ```js
|
|
544
|
+
* const util = require('util');
|
|
545
|
+
*
|
|
546
|
+
* util.isBuffer({ length: 0 });
|
|
547
|
+
* // Returns: false
|
|
548
|
+
* util.isBuffer([]);
|
|
549
|
+
* // Returns: false
|
|
550
|
+
* util.isBuffer(Buffer.from('hello world'));
|
|
551
|
+
* // Returns: true
|
|
552
|
+
* ```
|
|
553
|
+
* @since v0.11.5
|
|
554
|
+
* @deprecated Since v4.0.0 - Use `isBuffer` instead.
|
|
555
|
+
*/
|
|
556
|
+
export function isBuffer(object: unknown): object is Buffer;
|
|
557
|
+
/**
|
|
558
|
+
* Returns `true` if the given `object` is a `Function`. Otherwise, returns`false`.
|
|
559
|
+
*
|
|
560
|
+
* ```js
|
|
561
|
+
* const util = require('util');
|
|
562
|
+
*
|
|
563
|
+
* function Foo() {}
|
|
564
|
+
* const Bar = () => {};
|
|
565
|
+
*
|
|
566
|
+
* util.isFunction({});
|
|
567
|
+
* // Returns: false
|
|
568
|
+
* util.isFunction(Foo);
|
|
569
|
+
* // Returns: true
|
|
570
|
+
* util.isFunction(Bar);
|
|
571
|
+
* // Returns: true
|
|
572
|
+
* ```
|
|
573
|
+
* @since v0.11.5
|
|
574
|
+
* @deprecated Since v4.0.0 - Use `typeof value === 'function'` instead.
|
|
575
|
+
*/
|
|
576
|
+
export function isFunction(object: unknown): boolean;
|
|
577
|
+
/**
|
|
578
|
+
* Returns `true` if the given `object` is strictly `null`. Otherwise, returns`false`.
|
|
579
|
+
*
|
|
580
|
+
* ```js
|
|
581
|
+
* const util = require('util');
|
|
582
|
+
*
|
|
583
|
+
* util.isNull(0);
|
|
584
|
+
* // Returns: false
|
|
585
|
+
* util.isNull(undefined);
|
|
586
|
+
* // Returns: false
|
|
587
|
+
* util.isNull(null);
|
|
588
|
+
* // Returns: true
|
|
589
|
+
* ```
|
|
590
|
+
* @since v0.11.5
|
|
591
|
+
* @deprecated Since v4.0.0 - Use `value === null` instead.
|
|
592
|
+
*/
|
|
593
|
+
export function isNull(object: unknown): object is null;
|
|
594
|
+
/**
|
|
595
|
+
* Returns `true` if the given `object` is `null` or `undefined`. Otherwise,
|
|
596
|
+
* returns `false`.
|
|
597
|
+
*
|
|
598
|
+
* ```js
|
|
599
|
+
* const util = require('util');
|
|
600
|
+
*
|
|
601
|
+
* util.isNullOrUndefined(0);
|
|
602
|
+
* // Returns: false
|
|
603
|
+
* util.isNullOrUndefined(undefined);
|
|
604
|
+
* // Returns: true
|
|
605
|
+
* util.isNullOrUndefined(null);
|
|
606
|
+
* // Returns: true
|
|
607
|
+
* ```
|
|
608
|
+
* @since v0.11.5
|
|
609
|
+
* @deprecated Since v4.0.0 - Use `value === undefined || value === null` instead.
|
|
610
|
+
*/
|
|
611
|
+
export function isNullOrUndefined(object: unknown): object is null | undefined;
|
|
612
|
+
/**
|
|
613
|
+
* Returns `true` if the given `object` is a `Number`. Otherwise, returns `false`.
|
|
614
|
+
*
|
|
615
|
+
* ```js
|
|
616
|
+
* const util = require('util');
|
|
617
|
+
*
|
|
618
|
+
* util.isNumber(false);
|
|
619
|
+
* // Returns: false
|
|
620
|
+
* util.isNumber(Infinity);
|
|
621
|
+
* // Returns: true
|
|
622
|
+
* util.isNumber(0);
|
|
623
|
+
* // Returns: true
|
|
624
|
+
* util.isNumber(NaN);
|
|
625
|
+
* // Returns: true
|
|
626
|
+
* ```
|
|
627
|
+
* @since v0.11.5
|
|
628
|
+
* @deprecated Since v4.0.0 - Use `typeof value === 'number'` instead.
|
|
629
|
+
*/
|
|
630
|
+
export function isNumber(object: unknown): object is number;
|
|
631
|
+
/**
|
|
632
|
+
* Returns `true` if the given `object` is strictly an `Object`**and** not a`Function` (even though functions are objects in JavaScript).
|
|
633
|
+
* Otherwise, returns `false`.
|
|
634
|
+
*
|
|
635
|
+
* ```js
|
|
636
|
+
* const util = require('util');
|
|
637
|
+
*
|
|
638
|
+
* util.isObject(5);
|
|
639
|
+
* // Returns: false
|
|
640
|
+
* util.isObject(null);
|
|
641
|
+
* // Returns: false
|
|
642
|
+
* util.isObject({});
|
|
643
|
+
* // Returns: true
|
|
644
|
+
* util.isObject(() => {});
|
|
645
|
+
* // Returns: false
|
|
646
|
+
* ```
|
|
647
|
+
* @since v0.11.5
|
|
648
|
+
* @deprecated Since v4.0.0 - Deprecated: Use `value !== null && typeof value === 'object'` instead.
|
|
649
|
+
*/
|
|
650
|
+
export function isObject(object: unknown): boolean;
|
|
651
|
+
/**
|
|
652
|
+
* Returns `true` if the given `object` is a primitive type. Otherwise, returns`false`.
|
|
653
|
+
*
|
|
654
|
+
* ```js
|
|
655
|
+
* const util = require('util');
|
|
656
|
+
*
|
|
657
|
+
* util.isPrimitive(5);
|
|
658
|
+
* // Returns: true
|
|
659
|
+
* util.isPrimitive('foo');
|
|
660
|
+
* // Returns: true
|
|
661
|
+
* util.isPrimitive(false);
|
|
662
|
+
* // Returns: true
|
|
663
|
+
* util.isPrimitive(null);
|
|
664
|
+
* // Returns: true
|
|
665
|
+
* util.isPrimitive(undefined);
|
|
666
|
+
* // Returns: true
|
|
667
|
+
* util.isPrimitive({});
|
|
668
|
+
* // Returns: false
|
|
669
|
+
* util.isPrimitive(() => {});
|
|
670
|
+
* // Returns: false
|
|
671
|
+
* util.isPrimitive(/^$/);
|
|
672
|
+
* // Returns: false
|
|
673
|
+
* util.isPrimitive(new Date());
|
|
674
|
+
* // Returns: false
|
|
675
|
+
* ```
|
|
676
|
+
* @since v0.11.5
|
|
677
|
+
* @deprecated Since v4.0.0 - Use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead.
|
|
678
|
+
*/
|
|
679
|
+
export function isPrimitive(object: unknown): boolean;
|
|
680
|
+
/**
|
|
681
|
+
* Returns `true` if the given `object` is a `string`. Otherwise, returns `false`.
|
|
682
|
+
*
|
|
683
|
+
* ```js
|
|
684
|
+
* const util = require('util');
|
|
685
|
+
*
|
|
686
|
+
* util.isString('');
|
|
687
|
+
* // Returns: true
|
|
688
|
+
* util.isString('foo');
|
|
689
|
+
* // Returns: true
|
|
690
|
+
* util.isString(String('foo'));
|
|
691
|
+
* // Returns: true
|
|
692
|
+
* util.isString(5);
|
|
693
|
+
* // Returns: false
|
|
694
|
+
* ```
|
|
695
|
+
* @since v0.11.5
|
|
696
|
+
* @deprecated Since v4.0.0 - Use `typeof value === 'string'` instead.
|
|
697
|
+
*/
|
|
698
|
+
export function isString(object: unknown): object is string;
|
|
699
|
+
/**
|
|
700
|
+
* Returns `true` if the given `object` is a `Symbol`. Otherwise, returns `false`.
|
|
701
|
+
*
|
|
702
|
+
* ```js
|
|
703
|
+
* const util = require('util');
|
|
704
|
+
*
|
|
705
|
+
* util.isSymbol(5);
|
|
706
|
+
* // Returns: false
|
|
707
|
+
* util.isSymbol('foo');
|
|
708
|
+
* // Returns: false
|
|
709
|
+
* util.isSymbol(Symbol('foo'));
|
|
710
|
+
* // Returns: true
|
|
711
|
+
* ```
|
|
712
|
+
* @since v0.11.5
|
|
713
|
+
* @deprecated Since v4.0.0 - Use `typeof value === 'symbol'` instead.
|
|
714
|
+
*/
|
|
715
|
+
export function isSymbol(object: unknown): object is symbol;
|
|
716
|
+
/**
|
|
717
|
+
* Returns `true` if the given `object` is `undefined`. Otherwise, returns `false`.
|
|
718
|
+
*
|
|
719
|
+
* ```js
|
|
720
|
+
* const util = require('util');
|
|
721
|
+
*
|
|
722
|
+
* const foo = undefined;
|
|
723
|
+
* util.isUndefined(5);
|
|
724
|
+
* // Returns: false
|
|
725
|
+
* util.isUndefined(foo);
|
|
726
|
+
* // Returns: true
|
|
727
|
+
* util.isUndefined(null);
|
|
728
|
+
* // Returns: false
|
|
729
|
+
* ```
|
|
730
|
+
* @since v0.11.5
|
|
731
|
+
* @deprecated Since v4.0.0 - Use `value === undefined` instead.
|
|
732
|
+
*/
|
|
733
|
+
export function isUndefined(object: unknown): object is undefined;
|
|
734
|
+
/**
|
|
735
|
+
* The `util.deprecate()` method wraps `fn` (which may be a function or class) in
|
|
736
|
+
* such a way that it is marked as deprecated.
|
|
737
|
+
*
|
|
738
|
+
* ```js
|
|
739
|
+
* const util = require('util');
|
|
740
|
+
*
|
|
741
|
+
* exports.obsoleteFunction = util.deprecate(() => {
|
|
742
|
+
* // Do something here.
|
|
743
|
+
* }, 'obsoleteFunction() is deprecated. Use newShinyFunction() instead.');
|
|
744
|
+
* ```
|
|
745
|
+
*
|
|
746
|
+
* When called, `util.deprecate()` will return a function that will emit a`DeprecationWarning` using the `'warning'` event. The warning will
|
|
747
|
+
* be emitted and printed to `stderr` the first time the returned function is
|
|
748
|
+
* called. After the warning is emitted, the wrapped function is called without
|
|
749
|
+
* emitting a warning.
|
|
750
|
+
*
|
|
751
|
+
* If the same optional `code` is supplied in multiple calls to `util.deprecate()`,
|
|
752
|
+
* the warning will be emitted only once for that `code`.
|
|
753
|
+
*
|
|
754
|
+
* ```js
|
|
755
|
+
* const util = require('util');
|
|
756
|
+
*
|
|
757
|
+
* const fn1 = util.deprecate(someFunction, someMessage, 'DEP0001');
|
|
758
|
+
* const fn2 = util.deprecate(someOtherFunction, someOtherMessage, 'DEP0001');
|
|
759
|
+
* fn1(); // Emits a deprecation warning with code DEP0001
|
|
760
|
+
* fn2(); // Does not emit a deprecation warning because it has the same code
|
|
761
|
+
* ```
|
|
762
|
+
*
|
|
763
|
+
* If either the `--no-deprecation` or `--no-warnings` command-line flags are
|
|
764
|
+
* used, or if the `process.noDeprecation` property is set to `true`_prior_ to
|
|
765
|
+
* the first deprecation warning, the `util.deprecate()` method does nothing.
|
|
766
|
+
*
|
|
767
|
+
* If the `--trace-deprecation` or `--trace-warnings` command-line flags are set,
|
|
768
|
+
* or the `process.traceDeprecation` property is set to `true`, a warning and a
|
|
769
|
+
* stack trace are printed to `stderr` the first time the deprecated function is
|
|
770
|
+
* called.
|
|
771
|
+
*
|
|
772
|
+
* If the `--throw-deprecation` command-line flag is set, or the`process.throwDeprecation` property is set to `true`, then an exception will be
|
|
773
|
+
* thrown when the deprecated function is called.
|
|
774
|
+
*
|
|
775
|
+
* The `--throw-deprecation` command-line flag and `process.throwDeprecation`property take precedence over `--trace-deprecation` and`process.traceDeprecation`.
|
|
776
|
+
* @since v0.8.0
|
|
777
|
+
* @param fn The function that is being deprecated.
|
|
778
|
+
* @param msg A warning message to display when the deprecated function is invoked.
|
|
779
|
+
* @param code A deprecation code. See the `list of deprecated APIs` for a list of codes.
|
|
780
|
+
* @return The deprecated function wrapped to emit a warning.
|
|
781
|
+
*/
|
|
782
|
+
export function deprecate<T extends Function>(fn: T, msg: string, code?: string): T;
|
|
783
|
+
/**
|
|
784
|
+
* Returns `true` if there is deep strict equality between `val1` and `val2`.
|
|
785
|
+
* Otherwise, returns `false`.
|
|
786
|
+
*
|
|
787
|
+
* See `assert.deepStrictEqual()` for more information about deep strict
|
|
788
|
+
* equality.
|
|
789
|
+
* @since v9.0.0
|
|
790
|
+
*/
|
|
791
|
+
export function isDeepStrictEqual(val1: unknown, val2: unknown): boolean;
|
|
792
|
+
/**
|
|
793
|
+
* Takes an `async` function (or a function that returns a `Promise`) and returns a
|
|
794
|
+
* function following the error-first callback style, i.e. taking
|
|
795
|
+
* an `(err, value) => ...` callback as the last argument. In the callback, the
|
|
796
|
+
* first argument will be the rejection reason (or `null` if the `Promise`resolved), and the second argument will be the resolved value.
|
|
797
|
+
*
|
|
798
|
+
* ```js
|
|
799
|
+
* const util = require('util');
|
|
800
|
+
*
|
|
801
|
+
* async function fn() {
|
|
802
|
+
* return 'hello world';
|
|
803
|
+
* }
|
|
804
|
+
* const callbackFunction = util.callbackify(fn);
|
|
805
|
+
*
|
|
806
|
+
* callbackFunction((err, ret) => {
|
|
807
|
+
* if (err) throw err;
|
|
808
|
+
* console.log(ret);
|
|
809
|
+
* });
|
|
810
|
+
* ```
|
|
811
|
+
*
|
|
812
|
+
* Will print:
|
|
813
|
+
*
|
|
814
|
+
* ```text
|
|
815
|
+
* hello world
|
|
816
|
+
* ```
|
|
817
|
+
*
|
|
818
|
+
* The callback is executed asynchronously, and will have a limited stack trace.
|
|
819
|
+
* If the callback throws, the process will emit an `'uncaughtException'` event, and if not handled will exit.
|
|
820
|
+
*
|
|
821
|
+
* Since `null` has a special meaning as the first argument to a callback, if a
|
|
822
|
+
* wrapped function rejects a `Promise` with a falsy value as a reason, the value
|
|
823
|
+
* is wrapped in an `Error` with the original value stored in a field named`reason`.
|
|
824
|
+
*
|
|
825
|
+
* ```js
|
|
826
|
+
* function fn() {
|
|
827
|
+
* return Promise.reject(null);
|
|
828
|
+
* }
|
|
829
|
+
* const callbackFunction = util.callbackify(fn);
|
|
830
|
+
*
|
|
831
|
+
* callbackFunction((err, ret) => {
|
|
832
|
+
* // When the Promise was rejected with `null` it is wrapped with an Error and
|
|
833
|
+
* // the original value is stored in `reason`.
|
|
834
|
+
* err && err.hasOwnProperty('reason') && err.reason === null; // true
|
|
835
|
+
* });
|
|
836
|
+
* ```
|
|
837
|
+
* @since v8.2.0
|
|
838
|
+
* @param original An `async` function
|
|
839
|
+
* @return a callback style function
|
|
840
|
+
*/
|
|
841
|
+
export function callbackify(fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void;
|
|
842
|
+
export function callbackify<TResult>(fn: () => Promise<TResult>): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
|
843
|
+
export function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void;
|
|
844
|
+
export function callbackify<T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
|
845
|
+
export function callbackify<T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void;
|
|
846
|
+
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;
|
|
847
|
+
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;
|
|
848
|
+
export function callbackify<T1, T2, T3, TResult>(
|
|
849
|
+
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>
|
|
850
|
+
): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
|
851
|
+
export function callbackify<T1, T2, T3, T4>(
|
|
852
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>
|
|
853
|
+
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void;
|
|
854
|
+
export function callbackify<T1, T2, T3, T4, TResult>(
|
|
855
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>
|
|
856
|
+
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
|
857
|
+
export function callbackify<T1, T2, T3, T4, T5>(
|
|
858
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>
|
|
859
|
+
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void;
|
|
860
|
+
export function callbackify<T1, T2, T3, T4, T5, TResult>(
|
|
861
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>
|
|
862
|
+
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
|
863
|
+
export function callbackify<T1, T2, T3, T4, T5, T6>(
|
|
864
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>
|
|
865
|
+
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void;
|
|
866
|
+
export function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
|
|
867
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>
|
|
868
|
+
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
|
869
|
+
export interface CustomPromisifyLegacy<TCustom extends Function> extends Function {
|
|
870
|
+
__promisify__: TCustom;
|
|
871
|
+
}
|
|
872
|
+
export interface CustomPromisifySymbol<TCustom extends Function> extends Function {
|
|
873
|
+
[promisify.custom]: TCustom;
|
|
874
|
+
}
|
|
875
|
+
export type CustomPromisify<TCustom extends Function> = CustomPromisifySymbol<TCustom> | CustomPromisifyLegacy<TCustom>;
|
|
876
|
+
/**
|
|
877
|
+
* Takes a function following the common error-first callback style, i.e. taking
|
|
878
|
+
* an `(err, value) => ...` callback as the last argument, and returns a version
|
|
879
|
+
* that returns promises.
|
|
880
|
+
*
|
|
881
|
+
* ```js
|
|
882
|
+
* const util = require('util');
|
|
883
|
+
* const fs = require('fs');
|
|
884
|
+
*
|
|
885
|
+
* const stat = util.promisify(fs.stat);
|
|
886
|
+
* stat('.').then((stats) => {
|
|
887
|
+
* // Do something with `stats`
|
|
888
|
+
* }).catch((error) => {
|
|
889
|
+
* // Handle the error.
|
|
890
|
+
* });
|
|
891
|
+
* ```
|
|
892
|
+
*
|
|
893
|
+
* Or, equivalently using `async function`s:
|
|
894
|
+
*
|
|
895
|
+
* ```js
|
|
896
|
+
* const util = require('util');
|
|
897
|
+
* const fs = require('fs');
|
|
898
|
+
*
|
|
899
|
+
* const stat = util.promisify(fs.stat);
|
|
900
|
+
*
|
|
901
|
+
* async function callStat() {
|
|
902
|
+
* const stats = await stat('.');
|
|
903
|
+
* console.log(`This directory is owned by ${stats.uid}`);
|
|
904
|
+
* }
|
|
905
|
+
* ```
|
|
906
|
+
*
|
|
907
|
+
* If there is an `original[util.promisify.custom]` property present, `promisify`will return its value, see `Custom promisified functions`.
|
|
908
|
+
*
|
|
909
|
+
* `promisify()` assumes that `original` is a function taking a callback as its
|
|
910
|
+
* 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
|
|
911
|
+
* an error-first callback, it will still be passed an error-first
|
|
912
|
+
* callback as its last argument.
|
|
913
|
+
*
|
|
914
|
+
* Using `promisify()` on class methods or other methods that use `this` may not
|
|
915
|
+
* work as expected unless handled specially:
|
|
916
|
+
*
|
|
917
|
+
* ```js
|
|
918
|
+
* const util = require('util');
|
|
919
|
+
*
|
|
920
|
+
* class Foo {
|
|
921
|
+
* constructor() {
|
|
922
|
+
* this.a = 42;
|
|
923
|
+
* }
|
|
924
|
+
*
|
|
925
|
+
* bar(callback) {
|
|
926
|
+
* callback(null, this.a);
|
|
927
|
+
* }
|
|
928
|
+
* }
|
|
929
|
+
*
|
|
930
|
+
* const foo = new Foo();
|
|
931
|
+
*
|
|
932
|
+
* const naiveBar = util.promisify(foo.bar);
|
|
933
|
+
* // TypeError: Cannot read property 'a' of undefined
|
|
934
|
+
* // naiveBar().then(a => console.log(a));
|
|
935
|
+
*
|
|
936
|
+
* naiveBar.call(foo).then((a) => console.log(a)); // '42'
|
|
937
|
+
*
|
|
938
|
+
* const bindBar = naiveBar.bind(foo);
|
|
939
|
+
* bindBar().then((a) => console.log(a)); // '42'
|
|
940
|
+
* ```
|
|
941
|
+
* @since v8.0.0
|
|
942
|
+
*/
|
|
943
|
+
export function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
|
|
944
|
+
export function promisify<TResult>(fn: (callback: (err: any, result: TResult) => void) => void): () => Promise<TResult>;
|
|
945
|
+
export function promisify(fn: (callback: (err?: any) => void) => void): () => Promise<void>;
|
|
946
|
+
export function promisify<T1, TResult>(fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void): (arg1: T1) => Promise<TResult>;
|
|
947
|
+
export function promisify<T1>(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise<void>;
|
|
948
|
+
export function promisify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise<TResult>;
|
|
949
|
+
export function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2) => Promise<void>;
|
|
950
|
+
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>;
|
|
951
|
+
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>;
|
|
952
|
+
export function promisify<T1, T2, T3, T4, TResult>(
|
|
953
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void
|
|
954
|
+
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
|
|
955
|
+
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>;
|
|
956
|
+
export function promisify<T1, T2, T3, T4, T5, TResult>(
|
|
957
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void
|
|
958
|
+
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
|
|
959
|
+
export function promisify<T1, T2, T3, T4, T5>(
|
|
960
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void
|
|
961
|
+
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
|
|
962
|
+
export function promisify(fn: Function): Function;
|
|
963
|
+
export namespace promisify {
|
|
964
|
+
const custom: unique symbol;
|
|
965
|
+
}
|
|
966
|
+
/**
|
|
967
|
+
* An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextDecoder` API.
|
|
968
|
+
*
|
|
969
|
+
* ```js
|
|
970
|
+
* const decoder = new TextDecoder('shift_jis');
|
|
971
|
+
* let string = '';
|
|
972
|
+
* let buffer;
|
|
973
|
+
* while (buffer = getNextChunkSomehow()) {
|
|
974
|
+
* string += decoder.decode(buffer, { stream: true });
|
|
975
|
+
* }
|
|
976
|
+
* string += decoder.decode(); // end-of-stream
|
|
977
|
+
* ```
|
|
978
|
+
* @since v8.3.0
|
|
979
|
+
*/
|
|
980
|
+
export class TextDecoder {
|
|
981
|
+
/**
|
|
982
|
+
* The encoding supported by the `TextDecoder` instance.
|
|
983
|
+
*/
|
|
984
|
+
readonly encoding: string;
|
|
985
|
+
/**
|
|
986
|
+
* The value will be `true` if decoding errors result in a `TypeError` being
|
|
987
|
+
* thrown.
|
|
988
|
+
*/
|
|
989
|
+
readonly fatal: boolean;
|
|
990
|
+
/**
|
|
991
|
+
* The value will be `true` if the decoding result will include the byte order
|
|
992
|
+
* mark.
|
|
993
|
+
*/
|
|
994
|
+
readonly ignoreBOM: boolean;
|
|
995
|
+
constructor(
|
|
996
|
+
encoding?: string,
|
|
997
|
+
options?: {
|
|
998
|
+
fatal?: boolean | undefined;
|
|
999
|
+
ignoreBOM?: boolean | undefined;
|
|
1000
|
+
}
|
|
1001
|
+
);
|
|
1002
|
+
/**
|
|
1003
|
+
* Decodes the `input` and returns a string. If `options.stream` is `true`, any
|
|
1004
|
+
* incomplete byte sequences occurring at the end of the `input` are buffered
|
|
1005
|
+
* internally and emitted after the next call to `textDecoder.decode()`.
|
|
1006
|
+
*
|
|
1007
|
+
* If `textDecoder.fatal` is `true`, decoding errors that occur will result in a`TypeError` being thrown.
|
|
1008
|
+
* @param input An `ArrayBuffer`, `DataView` or `TypedArray` instance containing the encoded data.
|
|
1009
|
+
*/
|
|
1010
|
+
decode(
|
|
1011
|
+
input?: NodeJS.ArrayBufferView | ArrayBuffer | null,
|
|
1012
|
+
options?: {
|
|
1013
|
+
stream?: boolean | undefined;
|
|
1014
|
+
}
|
|
1015
|
+
): string;
|
|
1016
|
+
}
|
|
1017
|
+
export interface EncodeIntoResult {
|
|
1018
|
+
/**
|
|
1019
|
+
* The read Unicode code units of input.
|
|
1020
|
+
*/
|
|
1021
|
+
read: number;
|
|
1022
|
+
/**
|
|
1023
|
+
* The written UTF-8 bytes of output.
|
|
1024
|
+
*/
|
|
1025
|
+
written: number;
|
|
1026
|
+
}
|
|
1027
|
+
export { types };
|
|
1028
|
+
/**
|
|
1029
|
+
* An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextEncoder` API. All
|
|
1030
|
+
* instances of `TextEncoder` only support UTF-8 encoding.
|
|
1031
|
+
*
|
|
1032
|
+
* ```js
|
|
1033
|
+
* const encoder = new TextEncoder();
|
|
1034
|
+
* const uint8array = encoder.encode('this is some data');
|
|
1035
|
+
* ```
|
|
1036
|
+
*
|
|
1037
|
+
* The `TextEncoder` class is also available on the global object.
|
|
1038
|
+
* @since v8.3.0
|
|
1039
|
+
*/
|
|
1040
|
+
export class TextEncoder {
|
|
1041
|
+
/**
|
|
1042
|
+
* The encoding supported by the `TextEncoder` instance. Always set to `'utf-8'`.
|
|
1043
|
+
*/
|
|
1044
|
+
readonly encoding: string;
|
|
1045
|
+
/**
|
|
1046
|
+
* UTF-8 encodes the `input` string and returns a `Uint8Array` containing the
|
|
1047
|
+
* encoded bytes.
|
|
1048
|
+
* @param [input='an empty string'] The text to encode.
|
|
1049
|
+
*/
|
|
1050
|
+
encode(input?: string): Uint8Array;
|
|
1051
|
+
/**
|
|
1052
|
+
* UTF-8 encodes the `src` string to the `dest` Uint8Array and returns an object
|
|
1053
|
+
* containing the read Unicode code units and written UTF-8 bytes.
|
|
1054
|
+
*
|
|
1055
|
+
* ```js
|
|
1056
|
+
* const encoder = new TextEncoder();
|
|
1057
|
+
* const src = 'this is some data';
|
|
1058
|
+
* const dest = new Uint8Array(10);
|
|
1059
|
+
* const { read, written } = encoder.encodeInto(src, dest);
|
|
1060
|
+
* ```
|
|
1061
|
+
* @param src The text to encode.
|
|
1062
|
+
* @param dest The array to hold the encode result.
|
|
1063
|
+
*/
|
|
1064
|
+
encodeInto(src: string, dest: Uint8Array): EncodeIntoResult;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
declare module 'util/types' {
|
|
1068
|
+
export * from 'util/types';
|
|
1069
|
+
}
|
|
1070
|
+
declare module 'util/types' {
|
|
1071
|
+
import { KeyObject, webcrypto } from 'node:crypto';
|
|
1072
|
+
/**
|
|
1073
|
+
* Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) or
|
|
1074
|
+
* [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance.
|
|
1075
|
+
*
|
|
1076
|
+
* See also `util.types.isArrayBuffer()` and `util.types.isSharedArrayBuffer()`.
|
|
1077
|
+
*
|
|
1078
|
+
* ```js
|
|
1079
|
+
* util.types.isAnyArrayBuffer(new ArrayBuffer()); // Returns true
|
|
1080
|
+
* util.types.isAnyArrayBuffer(new SharedArrayBuffer()); // Returns true
|
|
1081
|
+
* ```
|
|
1082
|
+
* @since v10.0.0
|
|
1083
|
+
*/
|
|
1084
|
+
function isAnyArrayBuffer(object: unknown): object is ArrayBufferLike;
|
|
1085
|
+
/**
|
|
1086
|
+
* Returns `true` if the value is an `arguments` object.
|
|
1087
|
+
*
|
|
1088
|
+
* ```js
|
|
1089
|
+
* function foo() {
|
|
1090
|
+
* util.types.isArgumentsObject(arguments); // Returns true
|
|
1091
|
+
* }
|
|
1092
|
+
* ```
|
|
1093
|
+
* @since v10.0.0
|
|
1094
|
+
*/
|
|
1095
|
+
function isArgumentsObject(object: unknown): object is IArguments;
|
|
1096
|
+
/**
|
|
1097
|
+
* Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instance.
|
|
1098
|
+
* This does _not_ include [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instances. Usually, it is
|
|
1099
|
+
* desirable to test for both; See `util.types.isAnyArrayBuffer()` for that.
|
|
1100
|
+
*
|
|
1101
|
+
* ```js
|
|
1102
|
+
* util.types.isArrayBuffer(new ArrayBuffer()); // Returns true
|
|
1103
|
+
* util.types.isArrayBuffer(new SharedArrayBuffer()); // Returns false
|
|
1104
|
+
* ```
|
|
1105
|
+
* @since v10.0.0
|
|
1106
|
+
*/
|
|
1107
|
+
function isArrayBuffer(object: unknown): object is ArrayBuffer;
|
|
1108
|
+
/**
|
|
1109
|
+
* 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
|
|
1110
|
+
* array objects or [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView). Equivalent to
|
|
1111
|
+
* [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
|
|
1112
|
+
*
|
|
1113
|
+
* ```js
|
|
1114
|
+
* util.types.isArrayBufferView(new Int8Array()); // true
|
|
1115
|
+
* util.types.isArrayBufferView(Buffer.from('hello world')); // true
|
|
1116
|
+
* util.types.isArrayBufferView(new DataView(new ArrayBuffer(16))); // true
|
|
1117
|
+
* util.types.isArrayBufferView(new ArrayBuffer()); // false
|
|
1118
|
+
* ```
|
|
1119
|
+
* @since v10.0.0
|
|
1120
|
+
*/
|
|
1121
|
+
function isArrayBufferView(object: unknown): object is NodeJS.ArrayBufferView;
|
|
1122
|
+
/**
|
|
1123
|
+
* Returns `true` if the value is an [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function).
|
|
1124
|
+
* This only reports back what the JavaScript engine is seeing;
|
|
1125
|
+
* in particular, the return value may not match the original source code if
|
|
1126
|
+
* a transpilation tool was used.
|
|
1127
|
+
*
|
|
1128
|
+
* ```js
|
|
1129
|
+
* util.types.isAsyncFunction(function foo() {}); // Returns false
|
|
1130
|
+
* util.types.isAsyncFunction(async function foo() {}); // Returns true
|
|
1131
|
+
* ```
|
|
1132
|
+
* @since v10.0.0
|
|
1133
|
+
*/
|
|
1134
|
+
function isAsyncFunction(object: unknown): boolean;
|
|
1135
|
+
/**
|
|
1136
|
+
* Returns `true` if the value is a `BigInt64Array` instance.
|
|
1137
|
+
*
|
|
1138
|
+
* ```js
|
|
1139
|
+
* util.types.isBigInt64Array(new BigInt64Array()); // Returns true
|
|
1140
|
+
* util.types.isBigInt64Array(new BigUint64Array()); // Returns false
|
|
1141
|
+
* ```
|
|
1142
|
+
* @since v10.0.0
|
|
1143
|
+
*/
|
|
1144
|
+
function isBigInt64Array(value: unknown): value is BigInt64Array;
|
|
1145
|
+
/**
|
|
1146
|
+
* Returns `true` if the value is a `BigUint64Array` instance.
|
|
1147
|
+
*
|
|
1148
|
+
* ```js
|
|
1149
|
+
* util.types.isBigUint64Array(new BigInt64Array()); // Returns false
|
|
1150
|
+
* util.types.isBigUint64Array(new BigUint64Array()); // Returns true
|
|
1151
|
+
* ```
|
|
1152
|
+
* @since v10.0.0
|
|
1153
|
+
*/
|
|
1154
|
+
function isBigUint64Array(value: unknown): value is BigUint64Array;
|
|
1155
|
+
/**
|
|
1156
|
+
* Returns `true` if the value is a boolean object, e.g. created
|
|
1157
|
+
* by `new Boolean()`.
|
|
1158
|
+
*
|
|
1159
|
+
* ```js
|
|
1160
|
+
* util.types.isBooleanObject(false); // Returns false
|
|
1161
|
+
* util.types.isBooleanObject(true); // Returns false
|
|
1162
|
+
* util.types.isBooleanObject(new Boolean(false)); // Returns true
|
|
1163
|
+
* util.types.isBooleanObject(new Boolean(true)); // Returns true
|
|
1164
|
+
* util.types.isBooleanObject(Boolean(false)); // Returns false
|
|
1165
|
+
* util.types.isBooleanObject(Boolean(true)); // Returns false
|
|
1166
|
+
* ```
|
|
1167
|
+
* @since v10.0.0
|
|
1168
|
+
*/
|
|
1169
|
+
function isBooleanObject(object: unknown): object is Boolean;
|
|
1170
|
+
/**
|
|
1171
|
+
* Returns `true` if the value is any boxed primitive object, e.g. created
|
|
1172
|
+
* by `new Boolean()`, `new String()` or `Object(Symbol())`.
|
|
1173
|
+
*
|
|
1174
|
+
* For example:
|
|
1175
|
+
*
|
|
1176
|
+
* ```js
|
|
1177
|
+
* util.types.isBoxedPrimitive(false); // Returns false
|
|
1178
|
+
* util.types.isBoxedPrimitive(new Boolean(false)); // Returns true
|
|
1179
|
+
* util.types.isBoxedPrimitive(Symbol('foo')); // Returns false
|
|
1180
|
+
* util.types.isBoxedPrimitive(Object(Symbol('foo'))); // Returns true
|
|
1181
|
+
* util.types.isBoxedPrimitive(Object(BigInt(5))); // Returns true
|
|
1182
|
+
* ```
|
|
1183
|
+
* @since v10.11.0
|
|
1184
|
+
*/
|
|
1185
|
+
function isBoxedPrimitive(object: unknown): object is String | Number | BigInt | Boolean | Symbol;
|
|
1186
|
+
/**
|
|
1187
|
+
* Returns `true` if the value is a built-in [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) instance.
|
|
1188
|
+
*
|
|
1189
|
+
* ```js
|
|
1190
|
+
* const ab = new ArrayBuffer(20);
|
|
1191
|
+
* util.types.isDataView(new DataView(ab)); // Returns true
|
|
1192
|
+
* util.types.isDataView(new Float64Array()); // Returns false
|
|
1193
|
+
* ```
|
|
1194
|
+
*
|
|
1195
|
+
* See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
|
|
1196
|
+
* @since v10.0.0
|
|
1197
|
+
*/
|
|
1198
|
+
function isDataView(object: unknown): object is DataView;
|
|
1199
|
+
/**
|
|
1200
|
+
* Returns `true` if the value is a built-in [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) instance.
|
|
1201
|
+
*
|
|
1202
|
+
* ```js
|
|
1203
|
+
* util.types.isDate(new Date()); // Returns true
|
|
1204
|
+
* ```
|
|
1205
|
+
* @since v10.0.0
|
|
1206
|
+
*/
|
|
1207
|
+
function isDate(object: unknown): object is Date;
|
|
1208
|
+
/**
|
|
1209
|
+
* Returns `true` if the value is a native `External` value.
|
|
1210
|
+
*
|
|
1211
|
+
* A native `External` value is a special type of object that contains a
|
|
1212
|
+
* raw C++ pointer (`void*`) for access from native code, and has no other
|
|
1213
|
+
* properties. Such objects are created either by Node.js internals or native
|
|
1214
|
+
* 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.
|
|
1215
|
+
*
|
|
1216
|
+
* ```c
|
|
1217
|
+
* #include <js_native_api.h>
|
|
1218
|
+
* #include <stdlib.h>
|
|
1219
|
+
* napi_value result;
|
|
1220
|
+
* static napi_value MyNapi(napi_env env, napi_callback_info info) {
|
|
1221
|
+
* int* raw = (int*) malloc(1024);
|
|
1222
|
+
* napi_status status = napi_create_external(env, (void*) raw, NULL, NULL, &result);
|
|
1223
|
+
* if (status != napi_ok) {
|
|
1224
|
+
* napi_throw_error(env, NULL, "napi_create_external failed");
|
|
1225
|
+
* return NULL;
|
|
1226
|
+
* }
|
|
1227
|
+
* return result;
|
|
1228
|
+
* }
|
|
1229
|
+
* ...
|
|
1230
|
+
* DECLARE_NAPI_PROPERTY("myNapi", MyNapi)
|
|
1231
|
+
* ...
|
|
1232
|
+
* ```
|
|
1233
|
+
*
|
|
1234
|
+
* ```js
|
|
1235
|
+
* const native = require('napi_addon.node');
|
|
1236
|
+
* const data = native.myNapi();
|
|
1237
|
+
* util.types.isExternal(data); // returns true
|
|
1238
|
+
* util.types.isExternal(0); // returns false
|
|
1239
|
+
* util.types.isExternal(new String('foo')); // returns false
|
|
1240
|
+
* ```
|
|
1241
|
+
*
|
|
1242
|
+
* For further information on `napi_create_external`, refer to `napi_create_external()`.
|
|
1243
|
+
* @since v10.0.0
|
|
1244
|
+
*/
|
|
1245
|
+
function isExternal(object: unknown): boolean;
|
|
1246
|
+
/**
|
|
1247
|
+
* Returns `true` if the value is a built-in [`Float32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array) instance.
|
|
1248
|
+
*
|
|
1249
|
+
* ```js
|
|
1250
|
+
* util.types.isFloat32Array(new ArrayBuffer()); // Returns false
|
|
1251
|
+
* util.types.isFloat32Array(new Float32Array()); // Returns true
|
|
1252
|
+
* util.types.isFloat32Array(new Float64Array()); // Returns false
|
|
1253
|
+
* ```
|
|
1254
|
+
* @since v10.0.0
|
|
1255
|
+
*/
|
|
1256
|
+
function isFloat32Array(object: unknown): object is Float32Array;
|
|
1257
|
+
/**
|
|
1258
|
+
* Returns `true` if the value is a built-in [`Float64Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array) instance.
|
|
1259
|
+
*
|
|
1260
|
+
* ```js
|
|
1261
|
+
* util.types.isFloat64Array(new ArrayBuffer()); // Returns false
|
|
1262
|
+
* util.types.isFloat64Array(new Uint8Array()); // Returns false
|
|
1263
|
+
* util.types.isFloat64Array(new Float64Array()); // Returns true
|
|
1264
|
+
* ```
|
|
1265
|
+
* @since v10.0.0
|
|
1266
|
+
*/
|
|
1267
|
+
function isFloat64Array(object: unknown): object is Float64Array;
|
|
1268
|
+
/**
|
|
1269
|
+
* Returns `true` if the value is a generator function.
|
|
1270
|
+
* This only reports back what the JavaScript engine is seeing;
|
|
1271
|
+
* in particular, the return value may not match the original source code if
|
|
1272
|
+
* a transpilation tool was used.
|
|
1273
|
+
*
|
|
1274
|
+
* ```js
|
|
1275
|
+
* util.types.isGeneratorFunction(function foo() {}); // Returns false
|
|
1276
|
+
* util.types.isGeneratorFunction(function* foo() {}); // Returns true
|
|
1277
|
+
* ```
|
|
1278
|
+
* @since v10.0.0
|
|
1279
|
+
*/
|
|
1280
|
+
function isGeneratorFunction(object: unknown): object is GeneratorFunction;
|
|
1281
|
+
/**
|
|
1282
|
+
* Returns `true` if the value is a generator object as returned from a
|
|
1283
|
+
* built-in generator function.
|
|
1284
|
+
* This only reports back what the JavaScript engine is seeing;
|
|
1285
|
+
* in particular, the return value may not match the original source code if
|
|
1286
|
+
* a transpilation tool was used.
|
|
1287
|
+
*
|
|
1288
|
+
* ```js
|
|
1289
|
+
* function* foo() {}
|
|
1290
|
+
* const generator = foo();
|
|
1291
|
+
* util.types.isGeneratorObject(generator); // Returns true
|
|
1292
|
+
* ```
|
|
1293
|
+
* @since v10.0.0
|
|
1294
|
+
*/
|
|
1295
|
+
function isGeneratorObject(object: unknown): object is Generator;
|
|
1296
|
+
/**
|
|
1297
|
+
* Returns `true` if the value is a built-in [`Int8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array) instance.
|
|
1298
|
+
*
|
|
1299
|
+
* ```js
|
|
1300
|
+
* util.types.isInt8Array(new ArrayBuffer()); // Returns false
|
|
1301
|
+
* util.types.isInt8Array(new Int8Array()); // Returns true
|
|
1302
|
+
* util.types.isInt8Array(new Float64Array()); // Returns false
|
|
1303
|
+
* ```
|
|
1304
|
+
* @since v10.0.0
|
|
1305
|
+
*/
|
|
1306
|
+
function isInt8Array(object: unknown): object is Int8Array;
|
|
1307
|
+
/**
|
|
1308
|
+
* Returns `true` if the value is a built-in [`Int16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array) instance.
|
|
1309
|
+
*
|
|
1310
|
+
* ```js
|
|
1311
|
+
* util.types.isInt16Array(new ArrayBuffer()); // Returns false
|
|
1312
|
+
* util.types.isInt16Array(new Int16Array()); // Returns true
|
|
1313
|
+
* util.types.isInt16Array(new Float64Array()); // Returns false
|
|
1314
|
+
* ```
|
|
1315
|
+
* @since v10.0.0
|
|
1316
|
+
*/
|
|
1317
|
+
function isInt16Array(object: unknown): object is Int16Array;
|
|
1318
|
+
/**
|
|
1319
|
+
* Returns `true` if the value is a built-in [`Int32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array) instance.
|
|
1320
|
+
*
|
|
1321
|
+
* ```js
|
|
1322
|
+
* util.types.isInt32Array(new ArrayBuffer()); // Returns false
|
|
1323
|
+
* util.types.isInt32Array(new Int32Array()); // Returns true
|
|
1324
|
+
* util.types.isInt32Array(new Float64Array()); // Returns false
|
|
1325
|
+
* ```
|
|
1326
|
+
* @since v10.0.0
|
|
1327
|
+
*/
|
|
1328
|
+
function isInt32Array(object: unknown): object is Int32Array;
|
|
1329
|
+
/**
|
|
1330
|
+
* Returns `true` if the value is a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance.
|
|
1331
|
+
*
|
|
1332
|
+
* ```js
|
|
1333
|
+
* util.types.isMap(new Map()); // Returns true
|
|
1334
|
+
* ```
|
|
1335
|
+
* @since v10.0.0
|
|
1336
|
+
*/
|
|
1337
|
+
function isMap<T>(object: T | {}): object is T extends ReadonlyMap<any, any> ? (unknown extends T ? never : ReadonlyMap<any, any>) : Map<unknown, unknown>;
|
|
1338
|
+
/**
|
|
1339
|
+
* 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.
|
|
1340
|
+
*
|
|
1341
|
+
* ```js
|
|
1342
|
+
* const map = new Map();
|
|
1343
|
+
* util.types.isMapIterator(map.keys()); // Returns true
|
|
1344
|
+
* util.types.isMapIterator(map.values()); // Returns true
|
|
1345
|
+
* util.types.isMapIterator(map.entries()); // Returns true
|
|
1346
|
+
* util.types.isMapIterator(map[Symbol.iterator]()); // Returns true
|
|
1347
|
+
* ```
|
|
1348
|
+
* @since v10.0.0
|
|
1349
|
+
*/
|
|
1350
|
+
function isMapIterator(object: unknown): boolean;
|
|
1351
|
+
/**
|
|
1352
|
+
* Returns `true` if the value is an instance of a [Module Namespace Object](https://tc39.github.io/ecma262/#sec-module-namespace-exotic-objects).
|
|
1353
|
+
*
|
|
1354
|
+
* ```js
|
|
1355
|
+
* import * as ns from './a.js';
|
|
1356
|
+
*
|
|
1357
|
+
* util.types.isModuleNamespaceObject(ns); // Returns true
|
|
1358
|
+
* ```
|
|
1359
|
+
* @since v10.0.0
|
|
1360
|
+
*/
|
|
1361
|
+
function isModuleNamespaceObject(value: unknown): boolean;
|
|
1362
|
+
/**
|
|
1363
|
+
* Returns `true` if the value is an instance of a built-in `Error` type.
|
|
1364
|
+
*
|
|
1365
|
+
* ```js
|
|
1366
|
+
* util.types.isNativeError(new Error()); // Returns true
|
|
1367
|
+
* util.types.isNativeError(new TypeError()); // Returns true
|
|
1368
|
+
* util.types.isNativeError(new RangeError()); // Returns true
|
|
1369
|
+
* ```
|
|
1370
|
+
* @since v10.0.0
|
|
1371
|
+
*/
|
|
1372
|
+
function isNativeError(object: unknown): object is Error;
|
|
1373
|
+
/**
|
|
1374
|
+
* Returns `true` if the value is a number object, e.g. created
|
|
1375
|
+
* by `new Number()`.
|
|
1376
|
+
*
|
|
1377
|
+
* ```js
|
|
1378
|
+
* util.types.isNumberObject(0); // Returns false
|
|
1379
|
+
* util.types.isNumberObject(new Number(0)); // Returns true
|
|
1380
|
+
* ```
|
|
1381
|
+
* @since v10.0.0
|
|
1382
|
+
*/
|
|
1383
|
+
function isNumberObject(object: unknown): object is Number;
|
|
1384
|
+
/**
|
|
1385
|
+
* Returns `true` if the value is a built-in [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
|
|
1386
|
+
*
|
|
1387
|
+
* ```js
|
|
1388
|
+
* util.types.isPromise(Promise.resolve(42)); // Returns true
|
|
1389
|
+
* ```
|
|
1390
|
+
* @since v10.0.0
|
|
1391
|
+
*/
|
|
1392
|
+
function isPromise(object: unknown): object is Promise<unknown>;
|
|
1393
|
+
/**
|
|
1394
|
+
* Returns `true` if the value is a [`Proxy`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) instance.
|
|
1395
|
+
*
|
|
1396
|
+
* ```js
|
|
1397
|
+
* const target = {};
|
|
1398
|
+
* const proxy = new Proxy(target, {});
|
|
1399
|
+
* util.types.isProxy(target); // Returns false
|
|
1400
|
+
* util.types.isProxy(proxy); // Returns true
|
|
1401
|
+
* ```
|
|
1402
|
+
* @since v10.0.0
|
|
1403
|
+
*/
|
|
1404
|
+
function isProxy(object: unknown): boolean;
|
|
1405
|
+
/**
|
|
1406
|
+
* Returns `true` if the value is a regular expression object.
|
|
1407
|
+
*
|
|
1408
|
+
* ```js
|
|
1409
|
+
* util.types.isRegExp(/abc/); // Returns true
|
|
1410
|
+
* util.types.isRegExp(new RegExp('abc')); // Returns true
|
|
1411
|
+
* ```
|
|
1412
|
+
* @since v10.0.0
|
|
1413
|
+
*/
|
|
1414
|
+
function isRegExp(object: unknown): object is RegExp;
|
|
1415
|
+
/**
|
|
1416
|
+
* Returns `true` if the value is a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance.
|
|
1417
|
+
*
|
|
1418
|
+
* ```js
|
|
1419
|
+
* util.types.isSet(new Set()); // Returns true
|
|
1420
|
+
* ```
|
|
1421
|
+
* @since v10.0.0
|
|
1422
|
+
*/
|
|
1423
|
+
function isSet<T>(object: T | {}): object is T extends ReadonlySet<any> ? (unknown extends T ? never : ReadonlySet<any>) : Set<unknown>;
|
|
1424
|
+
/**
|
|
1425
|
+
* 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.
|
|
1426
|
+
*
|
|
1427
|
+
* ```js
|
|
1428
|
+
* const set = new Set();
|
|
1429
|
+
* util.types.isSetIterator(set.keys()); // Returns true
|
|
1430
|
+
* util.types.isSetIterator(set.values()); // Returns true
|
|
1431
|
+
* util.types.isSetIterator(set.entries()); // Returns true
|
|
1432
|
+
* util.types.isSetIterator(set[Symbol.iterator]()); // Returns true
|
|
1433
|
+
* ```
|
|
1434
|
+
* @since v10.0.0
|
|
1435
|
+
*/
|
|
1436
|
+
function isSetIterator(object: unknown): boolean;
|
|
1437
|
+
/**
|
|
1438
|
+
* Returns `true` if the value is a built-in [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance.
|
|
1439
|
+
* This does _not_ include [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instances. Usually, it is
|
|
1440
|
+
* desirable to test for both; See `util.types.isAnyArrayBuffer()` for that.
|
|
1441
|
+
*
|
|
1442
|
+
* ```js
|
|
1443
|
+
* util.types.isSharedArrayBuffer(new ArrayBuffer()); // Returns false
|
|
1444
|
+
* util.types.isSharedArrayBuffer(new SharedArrayBuffer()); // Returns true
|
|
1445
|
+
* ```
|
|
1446
|
+
* @since v10.0.0
|
|
1447
|
+
*/
|
|
1448
|
+
function isSharedArrayBuffer(object: unknown): object is SharedArrayBuffer;
|
|
1449
|
+
/**
|
|
1450
|
+
* Returns `true` if the value is a string object, e.g. created
|
|
1451
|
+
* by `new String()`.
|
|
1452
|
+
*
|
|
1453
|
+
* ```js
|
|
1454
|
+
* util.types.isStringObject('foo'); // Returns false
|
|
1455
|
+
* util.types.isStringObject(new String('foo')); // Returns true
|
|
1456
|
+
* ```
|
|
1457
|
+
* @since v10.0.0
|
|
1458
|
+
*/
|
|
1459
|
+
function isStringObject(object: unknown): object is String;
|
|
1460
|
+
/**
|
|
1461
|
+
* Returns `true` if the value is a symbol object, created
|
|
1462
|
+
* by calling `Object()` on a `Symbol` primitive.
|
|
1463
|
+
*
|
|
1464
|
+
* ```js
|
|
1465
|
+
* const symbol = Symbol('foo');
|
|
1466
|
+
* util.types.isSymbolObject(symbol); // Returns false
|
|
1467
|
+
* util.types.isSymbolObject(Object(symbol)); // Returns true
|
|
1468
|
+
* ```
|
|
1469
|
+
* @since v10.0.0
|
|
1470
|
+
*/
|
|
1471
|
+
function isSymbolObject(object: unknown): object is Symbol;
|
|
1472
|
+
/**
|
|
1473
|
+
* Returns `true` if the value is a built-in [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) instance.
|
|
1474
|
+
*
|
|
1475
|
+
* ```js
|
|
1476
|
+
* util.types.isTypedArray(new ArrayBuffer()); // Returns false
|
|
1477
|
+
* util.types.isTypedArray(new Uint8Array()); // Returns true
|
|
1478
|
+
* util.types.isTypedArray(new Float64Array()); // Returns true
|
|
1479
|
+
* ```
|
|
1480
|
+
*
|
|
1481
|
+
* See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
|
|
1482
|
+
* @since v10.0.0
|
|
1483
|
+
*/
|
|
1484
|
+
function isTypedArray(object: unknown): object is NodeJS.TypedArray;
|
|
1485
|
+
/**
|
|
1486
|
+
* Returns `true` if the value is a built-in [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) instance.
|
|
1487
|
+
*
|
|
1488
|
+
* ```js
|
|
1489
|
+
* util.types.isUint8Array(new ArrayBuffer()); // Returns false
|
|
1490
|
+
* util.types.isUint8Array(new Uint8Array()); // Returns true
|
|
1491
|
+
* util.types.isUint8Array(new Float64Array()); // Returns false
|
|
1492
|
+
* ```
|
|
1493
|
+
* @since v10.0.0
|
|
1494
|
+
*/
|
|
1495
|
+
function isUint8Array(object: unknown): object is Uint8Array;
|
|
1496
|
+
/**
|
|
1497
|
+
* Returns `true` if the value is a built-in [`Uint8ClampedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray) instance.
|
|
1498
|
+
*
|
|
1499
|
+
* ```js
|
|
1500
|
+
* util.types.isUint8ClampedArray(new ArrayBuffer()); // Returns false
|
|
1501
|
+
* util.types.isUint8ClampedArray(new Uint8ClampedArray()); // Returns true
|
|
1502
|
+
* util.types.isUint8ClampedArray(new Float64Array()); // Returns false
|
|
1503
|
+
* ```
|
|
1504
|
+
* @since v10.0.0
|
|
1505
|
+
*/
|
|
1506
|
+
function isUint8ClampedArray(object: unknown): object is Uint8ClampedArray;
|
|
1507
|
+
/**
|
|
1508
|
+
* Returns `true` if the value is a built-in [`Uint16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array) instance.
|
|
1509
|
+
*
|
|
1510
|
+
* ```js
|
|
1511
|
+
* util.types.isUint16Array(new ArrayBuffer()); // Returns false
|
|
1512
|
+
* util.types.isUint16Array(new Uint16Array()); // Returns true
|
|
1513
|
+
* util.types.isUint16Array(new Float64Array()); // Returns false
|
|
1514
|
+
* ```
|
|
1515
|
+
* @since v10.0.0
|
|
1516
|
+
*/
|
|
1517
|
+
function isUint16Array(object: unknown): object is Uint16Array;
|
|
1518
|
+
/**
|
|
1519
|
+
* Returns `true` if the value is a built-in [`Uint32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array) instance.
|
|
1520
|
+
*
|
|
1521
|
+
* ```js
|
|
1522
|
+
* util.types.isUint32Array(new ArrayBuffer()); // Returns false
|
|
1523
|
+
* util.types.isUint32Array(new Uint32Array()); // Returns true
|
|
1524
|
+
* util.types.isUint32Array(new Float64Array()); // Returns false
|
|
1525
|
+
* ```
|
|
1526
|
+
* @since v10.0.0
|
|
1527
|
+
*/
|
|
1528
|
+
function isUint32Array(object: unknown): object is Uint32Array;
|
|
1529
|
+
/**
|
|
1530
|
+
* Returns `true` if the value is a built-in [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) instance.
|
|
1531
|
+
*
|
|
1532
|
+
* ```js
|
|
1533
|
+
* util.types.isWeakMap(new WeakMap()); // Returns true
|
|
1534
|
+
* ```
|
|
1535
|
+
* @since v10.0.0
|
|
1536
|
+
*/
|
|
1537
|
+
function isWeakMap(object: unknown): object is WeakMap<object, unknown>;
|
|
1538
|
+
/**
|
|
1539
|
+
* Returns `true` if the value is a built-in [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) instance.
|
|
1540
|
+
*
|
|
1541
|
+
* ```js
|
|
1542
|
+
* util.types.isWeakSet(new WeakSet()); // Returns true
|
|
1543
|
+
* ```
|
|
1544
|
+
* @since v10.0.0
|
|
1545
|
+
*/
|
|
1546
|
+
function isWeakSet(object: unknown): object is WeakSet<object>;
|
|
1547
|
+
/**
|
|
1548
|
+
* Returns `true` if `value` is a `KeyObject`, `false` otherwise.
|
|
1549
|
+
* @since v16.2.0
|
|
1550
|
+
*/
|
|
1551
|
+
function isKeyObject(object: unknown): object is KeyObject;
|
|
1552
|
+
/**
|
|
1553
|
+
* Returns `true` if `value` is a `CryptoKey`, `false` otherwise.
|
|
1554
|
+
* @since v16.2.0
|
|
1555
|
+
*/
|
|
1556
|
+
function isCryptoKey(object: unknown): object is webcrypto.CryptoKey;
|
|
1557
|
+
}
|
|
1558
|
+
declare module 'node:util' {
|
|
1559
|
+
export * from 'util';
|
|
1560
|
+
}
|
|
1561
|
+
declare module 'node:util/types' {
|
|
1562
|
+
export * from 'util/types';
|
|
1563
|
+
}
|