cloudstructs 0.1.37 → 0.1.41
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 +3 -3
- package/lib/codecommit-mirror/index.js +2 -2
- package/lib/ecs-service-roller/index.js +2 -2
- package/lib/email-receiver/receiver.js +1 -1
- package/lib/saml-identity-provider/index.js +2 -2
- package/lib/slack-events/index.js +1 -1
- package/lib/slack-textract/index.js +1 -1
- package/lib/state-machine-cr-provider/index.js +1 -1
- package/lib/static-website/index.js +1 -1
- package/lib/url-shortener/index.handler.js +2 -1
- package/lib/url-shortener/index.js +1 -1
- package/node_modules/@sindresorhus/is/dist/index.d.ts +9 -4
- package/node_modules/@sindresorhus/is/dist/index.js +9 -0
- package/node_modules/@sindresorhus/is/package.json +1 -1
- package/node_modules/@sindresorhus/is/readme.md +26 -0
- package/node_modules/@slack/logger/node_modules/@types/node/README.md +3 -3
- package/node_modules/@slack/logger/node_modules/@types/node/assert/strict.d.ts +3 -4
- package/node_modules/@slack/logger/node_modules/@types/node/assert.d.ts +823 -40
- package/node_modules/@slack/logger/node_modules/@types/node/async_hooks.d.ts +359 -90
- package/node_modules/@slack/logger/node_modules/@types/node/buffer.d.ts +1895 -113
- package/node_modules/@slack/logger/node_modules/@types/node/child_process.d.ts +1070 -240
- package/node_modules/@slack/logger/node_modules/@types/node/cluster.d.ts +331 -104
- package/node_modules/@slack/logger/node_modules/@types/node/console.d.ts +310 -37
- package/node_modules/@slack/logger/node_modules/@types/node/constants.d.ts +3 -3
- package/node_modules/@slack/logger/node_modules/@types/node/crypto.d.ts +2406 -742
- package/node_modules/@slack/logger/node_modules/@types/node/dgram.d.ts +458 -58
- package/node_modules/@slack/logger/node_modules/@types/node/diagnostics_channel.d.ts +128 -0
- package/node_modules/@slack/logger/node_modules/@types/node/dns/promises.d.ts +292 -36
- package/node_modules/@slack/logger/node_modules/@types/node/dns.d.ts +414 -97
- package/node_modules/@slack/logger/node_modules/@types/node/domain.d.ts +153 -9
- package/node_modules/@slack/logger/node_modules/@types/node/events.d.ts +560 -35
- package/node_modules/@slack/logger/node_modules/@types/node/fs/promises.d.ts +735 -279
- package/node_modules/@slack/logger/node_modules/@types/node/fs.d.ts +2351 -870
- package/node_modules/@slack/logger/node_modules/@types/node/globals.d.ts +24 -14
- package/node_modules/@slack/logger/node_modules/@types/node/http.d.ts +1020 -98
- package/node_modules/@slack/logger/node_modules/@types/node/http2.d.ts +1586 -466
- package/node_modules/@slack/logger/node_modules/@types/node/https.d.ts +366 -15
- package/node_modules/@slack/logger/node_modules/@types/node/index.d.ts +87 -13
- package/node_modules/@slack/logger/node_modules/@types/node/inspector.d.ts +577 -562
- package/node_modules/@slack/logger/node_modules/@types/node/module.d.ts +53 -12
- package/node_modules/@slack/logger/node_modules/@types/node/net.d.ts +558 -143
- package/node_modules/@slack/logger/node_modules/@types/node/os.d.ts +236 -26
- package/node_modules/@slack/logger/node_modules/@types/node/package.json +18 -15
- package/node_modules/@slack/logger/node_modules/@types/node/path.d.ts +9 -5
- package/node_modules/@slack/logger/node_modules/@types/node/perf_hooks.d.ts +290 -92
- package/node_modules/@slack/logger/node_modules/@types/node/process.d.ts +1170 -156
- package/node_modules/@slack/logger/node_modules/@types/node/punycode.d.ts +64 -26
- package/node_modules/@slack/logger/node_modules/@types/node/querystring.d.ts +107 -8
- package/node_modules/@slack/logger/node_modules/@types/node/readline.d.ts +426 -80
- package/node_modules/@slack/logger/node_modules/@types/node/repl.d.ts +138 -113
- package/node_modules/@slack/logger/node_modules/@types/node/stream/consumers.d.ts +24 -0
- package/node_modules/@slack/logger/node_modules/@types/node/stream/promises.d.ts +15 -44
- package/node_modules/@slack/logger/node_modules/@types/node/stream/web.d.ts +6 -0
- package/node_modules/@slack/logger/node_modules/@types/node/stream.d.ts +979 -226
- package/node_modules/@slack/logger/node_modules/@types/node/string_decoder.d.ts +57 -1
- package/node_modules/@slack/logger/node_modules/@types/node/timers/promises.d.ts +53 -10
- package/node_modules/@slack/logger/node_modules/@types/node/timers.d.ts +32 -39
- package/node_modules/@slack/logger/node_modules/@types/node/tls.d.ts +449 -227
- package/node_modules/@slack/logger/node_modules/@types/node/trace_events.d.ts +107 -11
- package/node_modules/@slack/logger/node_modules/@types/node/tty.d.ts +160 -24
- package/node_modules/@slack/logger/node_modules/@types/node/url.d.ts +703 -32
- package/node_modules/@slack/logger/node_modules/@types/node/util.d.ts +1375 -76
- package/node_modules/@slack/logger/node_modules/@types/node/v8.d.ts +255 -79
- package/node_modules/@slack/logger/node_modules/@types/node/vm.d.ts +384 -33
- package/node_modules/@slack/logger/node_modules/@types/node/wasi.d.ts +92 -24
- package/node_modules/@slack/logger/node_modules/@types/node/worker_threads.d.ts +501 -138
- package/node_modules/@slack/logger/node_modules/@types/node/zlib.d.ts +216 -64
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +3 -3
- package/node_modules/@slack/web-api/node_modules/@types/node/assert/strict.d.ts +3 -4
- package/node_modules/@slack/web-api/node_modules/@types/node/assert.d.ts +823 -40
- package/node_modules/@slack/web-api/node_modules/@types/node/async_hooks.d.ts +359 -90
- package/node_modules/@slack/web-api/node_modules/@types/node/buffer.d.ts +1895 -113
- package/node_modules/@slack/web-api/node_modules/@types/node/child_process.d.ts +1070 -240
- package/node_modules/@slack/web-api/node_modules/@types/node/cluster.d.ts +331 -104
- package/node_modules/@slack/web-api/node_modules/@types/node/console.d.ts +310 -37
- package/node_modules/@slack/web-api/node_modules/@types/node/constants.d.ts +3 -3
- package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +2406 -742
- package/node_modules/@slack/web-api/node_modules/@types/node/dgram.d.ts +458 -58
- package/node_modules/@slack/web-api/node_modules/@types/node/diagnostics_channel.d.ts +128 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/dns/promises.d.ts +292 -36
- package/node_modules/@slack/web-api/node_modules/@types/node/dns.d.ts +414 -97
- package/node_modules/@slack/web-api/node_modules/@types/node/domain.d.ts +153 -9
- package/node_modules/@slack/web-api/node_modules/@types/node/events.d.ts +560 -35
- package/node_modules/@slack/web-api/node_modules/@types/node/fs/promises.d.ts +735 -279
- package/node_modules/@slack/web-api/node_modules/@types/node/fs.d.ts +2351 -870
- package/node_modules/@slack/web-api/node_modules/@types/node/globals.d.ts +24 -14
- package/node_modules/@slack/web-api/node_modules/@types/node/http.d.ts +1020 -98
- package/node_modules/@slack/web-api/node_modules/@types/node/http2.d.ts +1586 -466
- package/node_modules/@slack/web-api/node_modules/@types/node/https.d.ts +366 -15
- package/node_modules/@slack/web-api/node_modules/@types/node/index.d.ts +87 -13
- package/node_modules/@slack/web-api/node_modules/@types/node/inspector.d.ts +577 -562
- package/node_modules/@slack/web-api/node_modules/@types/node/module.d.ts +53 -12
- package/node_modules/@slack/web-api/node_modules/@types/node/net.d.ts +558 -143
- package/node_modules/@slack/web-api/node_modules/@types/node/os.d.ts +236 -26
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +18 -15
- package/node_modules/@slack/web-api/node_modules/@types/node/path.d.ts +9 -5
- package/node_modules/@slack/web-api/node_modules/@types/node/perf_hooks.d.ts +290 -92
- package/node_modules/@slack/web-api/node_modules/@types/node/process.d.ts +1170 -156
- package/node_modules/@slack/web-api/node_modules/@types/node/punycode.d.ts +64 -26
- package/node_modules/@slack/web-api/node_modules/@types/node/querystring.d.ts +107 -8
- package/node_modules/@slack/web-api/node_modules/@types/node/readline.d.ts +426 -80
- package/node_modules/@slack/web-api/node_modules/@types/node/repl.d.ts +138 -113
- package/node_modules/@slack/web-api/node_modules/@types/node/stream/consumers.d.ts +24 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/stream/promises.d.ts +15 -44
- package/node_modules/@slack/web-api/node_modules/@types/node/stream/web.d.ts +6 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/stream.d.ts +979 -226
- package/node_modules/@slack/web-api/node_modules/@types/node/string_decoder.d.ts +57 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/timers/promises.d.ts +53 -10
- package/node_modules/@slack/web-api/node_modules/@types/node/timers.d.ts +32 -39
- package/node_modules/@slack/web-api/node_modules/@types/node/tls.d.ts +449 -227
- package/node_modules/@slack/web-api/node_modules/@types/node/trace_events.d.ts +107 -11
- package/node_modules/@slack/web-api/node_modules/@types/node/tty.d.ts +160 -24
- package/node_modules/@slack/web-api/node_modules/@types/node/url.d.ts +703 -32
- package/node_modules/@slack/web-api/node_modules/@types/node/util.d.ts +1375 -76
- package/node_modules/@slack/web-api/node_modules/@types/node/v8.d.ts +255 -79
- package/node_modules/@slack/web-api/node_modules/@types/node/vm.d.ts +384 -33
- package/node_modules/@slack/web-api/node_modules/@types/node/wasi.d.ts +92 -24
- package/node_modules/@slack/web-api/node_modules/@types/node/worker_threads.d.ts +501 -138
- package/node_modules/@slack/web-api/node_modules/@types/node/zlib.d.ts +216 -64
- package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +3 -3
- package/node_modules/@types/cacheable-request/node_modules/@types/node/assert/strict.d.ts +3 -4
- package/node_modules/@types/cacheable-request/node_modules/@types/node/assert.d.ts +823 -40
- package/node_modules/@types/cacheable-request/node_modules/@types/node/async_hooks.d.ts +359 -90
- package/node_modules/@types/cacheable-request/node_modules/@types/node/buffer.d.ts +1895 -113
- package/node_modules/@types/cacheable-request/node_modules/@types/node/child_process.d.ts +1070 -240
- package/node_modules/@types/cacheable-request/node_modules/@types/node/cluster.d.ts +331 -104
- package/node_modules/@types/cacheable-request/node_modules/@types/node/console.d.ts +310 -37
- package/node_modules/@types/cacheable-request/node_modules/@types/node/constants.d.ts +3 -3
- package/node_modules/@types/cacheable-request/node_modules/@types/node/crypto.d.ts +2406 -742
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dgram.d.ts +458 -58
- 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 +292 -36
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dns.d.ts +414 -97
- package/node_modules/@types/cacheable-request/node_modules/@types/node/domain.d.ts +153 -9
- package/node_modules/@types/cacheable-request/node_modules/@types/node/events.d.ts +560 -35
- package/node_modules/@types/cacheable-request/node_modules/@types/node/fs/promises.d.ts +735 -279
- package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +2351 -870
- package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.d.ts +24 -14
- package/node_modules/@types/cacheable-request/node_modules/@types/node/http.d.ts +1020 -98
- package/node_modules/@types/cacheable-request/node_modules/@types/node/http2.d.ts +1586 -466
- package/node_modules/@types/cacheable-request/node_modules/@types/node/https.d.ts +366 -15
- package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +87 -13
- package/node_modules/@types/cacheable-request/node_modules/@types/node/inspector.d.ts +577 -562
- package/node_modules/@types/cacheable-request/node_modules/@types/node/module.d.ts +53 -12
- package/node_modules/@types/cacheable-request/node_modules/@types/node/net.d.ts +558 -143
- package/node_modules/@types/cacheable-request/node_modules/@types/node/os.d.ts +236 -26
- package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +18 -15
- package/node_modules/@types/cacheable-request/node_modules/@types/node/path.d.ts +9 -5
- package/node_modules/@types/cacheable-request/node_modules/@types/node/perf_hooks.d.ts +290 -92
- package/node_modules/@types/cacheable-request/node_modules/@types/node/process.d.ts +1170 -156
- package/node_modules/@types/cacheable-request/node_modules/@types/node/punycode.d.ts +64 -26
- package/node_modules/@types/cacheable-request/node_modules/@types/node/querystring.d.ts +107 -8
- package/node_modules/@types/cacheable-request/node_modules/@types/node/readline.d.ts +426 -80
- package/node_modules/@types/cacheable-request/node_modules/@types/node/repl.d.ts +138 -113
- 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 +15 -44
- 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 +979 -226
- package/node_modules/@types/cacheable-request/node_modules/@types/node/string_decoder.d.ts +57 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/timers/promises.d.ts +53 -10
- package/node_modules/@types/cacheable-request/node_modules/@types/node/timers.d.ts +32 -39
- package/node_modules/@types/cacheable-request/node_modules/@types/node/tls.d.ts +449 -227
- package/node_modules/@types/cacheable-request/node_modules/@types/node/trace_events.d.ts +107 -11
- package/node_modules/@types/cacheable-request/node_modules/@types/node/tty.d.ts +160 -24
- package/node_modules/@types/cacheable-request/node_modules/@types/node/url.d.ts +703 -32
- package/node_modules/@types/cacheable-request/node_modules/@types/node/util.d.ts +1375 -76
- package/node_modules/@types/cacheable-request/node_modules/@types/node/v8.d.ts +255 -79
- package/node_modules/@types/cacheable-request/node_modules/@types/node/vm.d.ts +384 -33
- package/node_modules/@types/cacheable-request/node_modules/@types/node/wasi.d.ts +92 -24
- package/node_modules/@types/cacheable-request/node_modules/@types/node/worker_threads.d.ts +501 -138
- package/node_modules/@types/cacheable-request/node_modules/@types/node/zlib.d.ts +216 -64
- package/node_modules/@types/is-stream/node_modules/@types/node/README.md +3 -3
- package/node_modules/@types/is-stream/node_modules/@types/node/assert/strict.d.ts +3 -4
- package/node_modules/@types/is-stream/node_modules/@types/node/assert.d.ts +823 -40
- package/node_modules/@types/is-stream/node_modules/@types/node/async_hooks.d.ts +359 -90
- package/node_modules/@types/is-stream/node_modules/@types/node/buffer.d.ts +1895 -113
- package/node_modules/@types/is-stream/node_modules/@types/node/child_process.d.ts +1070 -240
- package/node_modules/@types/is-stream/node_modules/@types/node/cluster.d.ts +331 -104
- package/node_modules/@types/is-stream/node_modules/@types/node/console.d.ts +310 -37
- package/node_modules/@types/is-stream/node_modules/@types/node/constants.d.ts +3 -3
- package/node_modules/@types/is-stream/node_modules/@types/node/crypto.d.ts +2406 -742
- package/node_modules/@types/is-stream/node_modules/@types/node/dgram.d.ts +458 -58
- package/node_modules/@types/is-stream/node_modules/@types/node/diagnostics_channel.d.ts +128 -0
- package/node_modules/@types/is-stream/node_modules/@types/node/dns/promises.d.ts +292 -36
- package/node_modules/@types/is-stream/node_modules/@types/node/dns.d.ts +414 -97
- package/node_modules/@types/is-stream/node_modules/@types/node/domain.d.ts +153 -9
- package/node_modules/@types/is-stream/node_modules/@types/node/events.d.ts +560 -35
- package/node_modules/@types/is-stream/node_modules/@types/node/fs/promises.d.ts +735 -279
- package/node_modules/@types/is-stream/node_modules/@types/node/fs.d.ts +2351 -870
- package/node_modules/@types/is-stream/node_modules/@types/node/globals.d.ts +24 -14
- package/node_modules/@types/is-stream/node_modules/@types/node/http.d.ts +1020 -98
- package/node_modules/@types/is-stream/node_modules/@types/node/http2.d.ts +1586 -466
- package/node_modules/@types/is-stream/node_modules/@types/node/https.d.ts +366 -15
- package/node_modules/@types/is-stream/node_modules/@types/node/index.d.ts +87 -13
- package/node_modules/@types/is-stream/node_modules/@types/node/inspector.d.ts +577 -562
- package/node_modules/@types/is-stream/node_modules/@types/node/module.d.ts +53 -12
- package/node_modules/@types/is-stream/node_modules/@types/node/net.d.ts +558 -143
- package/node_modules/@types/is-stream/node_modules/@types/node/os.d.ts +236 -26
- package/node_modules/@types/is-stream/node_modules/@types/node/package.json +18 -15
- package/node_modules/@types/is-stream/node_modules/@types/node/path.d.ts +9 -5
- package/node_modules/@types/is-stream/node_modules/@types/node/perf_hooks.d.ts +290 -92
- package/node_modules/@types/is-stream/node_modules/@types/node/process.d.ts +1170 -156
- package/node_modules/@types/is-stream/node_modules/@types/node/punycode.d.ts +64 -26
- package/node_modules/@types/is-stream/node_modules/@types/node/querystring.d.ts +107 -8
- package/node_modules/@types/is-stream/node_modules/@types/node/readline.d.ts +426 -80
- package/node_modules/@types/is-stream/node_modules/@types/node/repl.d.ts +138 -113
- package/node_modules/@types/is-stream/node_modules/@types/node/stream/consumers.d.ts +24 -0
- package/node_modules/@types/is-stream/node_modules/@types/node/stream/promises.d.ts +15 -44
- package/node_modules/@types/is-stream/node_modules/@types/node/stream/web.d.ts +6 -0
- package/node_modules/@types/is-stream/node_modules/@types/node/stream.d.ts +979 -226
- package/node_modules/@types/is-stream/node_modules/@types/node/string_decoder.d.ts +57 -1
- package/node_modules/@types/is-stream/node_modules/@types/node/timers/promises.d.ts +53 -10
- package/node_modules/@types/is-stream/node_modules/@types/node/timers.d.ts +32 -39
- package/node_modules/@types/is-stream/node_modules/@types/node/tls.d.ts +449 -227
- package/node_modules/@types/is-stream/node_modules/@types/node/trace_events.d.ts +107 -11
- package/node_modules/@types/is-stream/node_modules/@types/node/tty.d.ts +160 -24
- package/node_modules/@types/is-stream/node_modules/@types/node/url.d.ts +703 -32
- package/node_modules/@types/is-stream/node_modules/@types/node/util.d.ts +1375 -76
- package/node_modules/@types/is-stream/node_modules/@types/node/v8.d.ts +255 -79
- package/node_modules/@types/is-stream/node_modules/@types/node/vm.d.ts +384 -33
- package/node_modules/@types/is-stream/node_modules/@types/node/wasi.d.ts +92 -24
- package/node_modules/@types/is-stream/node_modules/@types/node/worker_threads.d.ts +501 -138
- package/node_modules/@types/is-stream/node_modules/@types/node/zlib.d.ts +216 -64
- package/node_modules/@types/keyv/README.md +1 -1
- package/node_modules/@types/keyv/index.d.ts +10 -3
- package/node_modules/@types/keyv/node_modules/@types/node/README.md +3 -3
- package/node_modules/@types/keyv/node_modules/@types/node/assert/strict.d.ts +3 -4
- package/node_modules/@types/keyv/node_modules/@types/node/assert.d.ts +823 -40
- package/node_modules/@types/keyv/node_modules/@types/node/async_hooks.d.ts +359 -90
- package/node_modules/@types/keyv/node_modules/@types/node/buffer.d.ts +1895 -113
- package/node_modules/@types/keyv/node_modules/@types/node/child_process.d.ts +1070 -240
- package/node_modules/@types/keyv/node_modules/@types/node/cluster.d.ts +331 -104
- package/node_modules/@types/keyv/node_modules/@types/node/console.d.ts +310 -37
- package/node_modules/@types/keyv/node_modules/@types/node/constants.d.ts +3 -3
- package/node_modules/@types/keyv/node_modules/@types/node/crypto.d.ts +2406 -742
- package/node_modules/@types/keyv/node_modules/@types/node/dgram.d.ts +458 -58
- 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 +292 -36
- package/node_modules/@types/keyv/node_modules/@types/node/dns.d.ts +414 -97
- package/node_modules/@types/keyv/node_modules/@types/node/domain.d.ts +153 -9
- package/node_modules/@types/keyv/node_modules/@types/node/events.d.ts +560 -35
- package/node_modules/@types/keyv/node_modules/@types/node/fs/promises.d.ts +735 -279
- package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +2351 -870
- package/node_modules/@types/keyv/node_modules/@types/node/globals.d.ts +24 -14
- package/node_modules/@types/keyv/node_modules/@types/node/http.d.ts +1020 -98
- package/node_modules/@types/keyv/node_modules/@types/node/http2.d.ts +1586 -466
- package/node_modules/@types/keyv/node_modules/@types/node/https.d.ts +366 -15
- package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +87 -13
- package/node_modules/@types/keyv/node_modules/@types/node/inspector.d.ts +577 -562
- package/node_modules/@types/keyv/node_modules/@types/node/module.d.ts +53 -12
- package/node_modules/@types/keyv/node_modules/@types/node/net.d.ts +558 -143
- package/node_modules/@types/keyv/node_modules/@types/node/os.d.ts +236 -26
- package/node_modules/@types/keyv/node_modules/@types/node/package.json +18 -15
- package/node_modules/@types/keyv/node_modules/@types/node/path.d.ts +9 -5
- package/node_modules/@types/keyv/node_modules/@types/node/perf_hooks.d.ts +290 -92
- package/node_modules/@types/keyv/node_modules/@types/node/process.d.ts +1170 -156
- package/node_modules/@types/keyv/node_modules/@types/node/punycode.d.ts +64 -26
- package/node_modules/@types/keyv/node_modules/@types/node/querystring.d.ts +107 -8
- package/node_modules/@types/keyv/node_modules/@types/node/readline.d.ts +426 -80
- package/node_modules/@types/keyv/node_modules/@types/node/repl.d.ts +138 -113
- 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 +15 -44
- 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 +979 -226
- package/node_modules/@types/keyv/node_modules/@types/node/string_decoder.d.ts +57 -1
- package/node_modules/@types/keyv/node_modules/@types/node/timers/promises.d.ts +53 -10
- package/node_modules/@types/keyv/node_modules/@types/node/timers.d.ts +32 -39
- package/node_modules/@types/keyv/node_modules/@types/node/tls.d.ts +449 -227
- package/node_modules/@types/keyv/node_modules/@types/node/trace_events.d.ts +107 -11
- package/node_modules/@types/keyv/node_modules/@types/node/tty.d.ts +160 -24
- package/node_modules/@types/keyv/node_modules/@types/node/url.d.ts +703 -32
- package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +1375 -76
- package/node_modules/@types/keyv/node_modules/@types/node/v8.d.ts +255 -79
- package/node_modules/@types/keyv/node_modules/@types/node/vm.d.ts +384 -33
- package/node_modules/@types/keyv/node_modules/@types/node/wasi.d.ts +92 -24
- package/node_modules/@types/keyv/node_modules/@types/node/worker_threads.d.ts +501 -138
- package/node_modules/@types/keyv/node_modules/@types/node/zlib.d.ts +216 -64
- package/node_modules/@types/keyv/package.json +3 -3
- package/node_modules/@types/responselike/node_modules/@types/node/README.md +3 -3
- package/node_modules/@types/responselike/node_modules/@types/node/assert/strict.d.ts +3 -4
- package/node_modules/@types/responselike/node_modules/@types/node/assert.d.ts +823 -40
- package/node_modules/@types/responselike/node_modules/@types/node/async_hooks.d.ts +359 -90
- package/node_modules/@types/responselike/node_modules/@types/node/buffer.d.ts +1895 -113
- package/node_modules/@types/responselike/node_modules/@types/node/child_process.d.ts +1070 -240
- package/node_modules/@types/responselike/node_modules/@types/node/cluster.d.ts +331 -104
- package/node_modules/@types/responselike/node_modules/@types/node/console.d.ts +310 -37
- package/node_modules/@types/responselike/node_modules/@types/node/constants.d.ts +3 -3
- package/node_modules/@types/responselike/node_modules/@types/node/crypto.d.ts +2406 -742
- package/node_modules/@types/responselike/node_modules/@types/node/dgram.d.ts +458 -58
- 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 +292 -36
- package/node_modules/@types/responselike/node_modules/@types/node/dns.d.ts +414 -97
- package/node_modules/@types/responselike/node_modules/@types/node/domain.d.ts +153 -9
- package/node_modules/@types/responselike/node_modules/@types/node/events.d.ts +560 -35
- package/node_modules/@types/responselike/node_modules/@types/node/fs/promises.d.ts +735 -279
- package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +2351 -870
- package/node_modules/@types/responselike/node_modules/@types/node/globals.d.ts +24 -14
- package/node_modules/@types/responselike/node_modules/@types/node/http.d.ts +1020 -98
- package/node_modules/@types/responselike/node_modules/@types/node/http2.d.ts +1586 -466
- package/node_modules/@types/responselike/node_modules/@types/node/https.d.ts +366 -15
- package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +87 -13
- package/node_modules/@types/responselike/node_modules/@types/node/inspector.d.ts +577 -562
- package/node_modules/@types/responselike/node_modules/@types/node/module.d.ts +53 -12
- package/node_modules/@types/responselike/node_modules/@types/node/net.d.ts +558 -143
- package/node_modules/@types/responselike/node_modules/@types/node/os.d.ts +236 -26
- package/node_modules/@types/responselike/node_modules/@types/node/package.json +18 -15
- package/node_modules/@types/responselike/node_modules/@types/node/path.d.ts +9 -5
- package/node_modules/@types/responselike/node_modules/@types/node/perf_hooks.d.ts +290 -92
- package/node_modules/@types/responselike/node_modules/@types/node/process.d.ts +1170 -156
- package/node_modules/@types/responselike/node_modules/@types/node/punycode.d.ts +64 -26
- package/node_modules/@types/responselike/node_modules/@types/node/querystring.d.ts +107 -8
- package/node_modules/@types/responselike/node_modules/@types/node/readline.d.ts +426 -80
- package/node_modules/@types/responselike/node_modules/@types/node/repl.d.ts +138 -113
- 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 +15 -44
- 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 +979 -226
- package/node_modules/@types/responselike/node_modules/@types/node/string_decoder.d.ts +57 -1
- package/node_modules/@types/responselike/node_modules/@types/node/timers/promises.d.ts +53 -10
- package/node_modules/@types/responselike/node_modules/@types/node/timers.d.ts +32 -39
- package/node_modules/@types/responselike/node_modules/@types/node/tls.d.ts +449 -227
- package/node_modules/@types/responselike/node_modules/@types/node/trace_events.d.ts +107 -11
- package/node_modules/@types/responselike/node_modules/@types/node/tty.d.ts +160 -24
- package/node_modules/@types/responselike/node_modules/@types/node/url.d.ts +703 -32
- package/node_modules/@types/responselike/node_modules/@types/node/util.d.ts +1375 -76
- package/node_modules/@types/responselike/node_modules/@types/node/v8.d.ts +255 -79
- package/node_modules/@types/responselike/node_modules/@types/node/vm.d.ts +384 -33
- package/node_modules/@types/responselike/node_modules/@types/node/wasi.d.ts +92 -24
- package/node_modules/@types/responselike/node_modules/@types/node/worker_threads.d.ts +501 -138
- package/node_modules/@types/responselike/node_modules/@types/node/zlib.d.ts +216 -64
- package/node_modules/axios/CHANGELOG.md +98 -8
- package/node_modules/axios/README.md +74 -6
- package/node_modules/axios/SECURITY.md +5 -0
- package/node_modules/axios/dist/axios.js +2028 -1591
- package/node_modules/axios/dist/axios.map +1 -1
- package/node_modules/axios/dist/axios.min.js +2 -2
- package/node_modules/axios/dist/axios.min.map +1 -1
- package/node_modules/axios/index.d.ts +8 -1
- package/node_modules/axios/lib/adapters/http.js +33 -5
- package/node_modules/axios/lib/adapters/xhr.js +35 -25
- package/node_modules/axios/lib/core/Axios.js +60 -7
- package/node_modules/axios/lib/core/InterceptorManager.js +4 -2
- package/node_modules/axios/lib/core/README.md +1 -0
- package/node_modules/axios/lib/core/dispatchRequest.js +6 -3
- package/node_modules/axios/lib/core/transformData.js +3 -1
- package/node_modules/axios/lib/defaults.js +43 -7
- package/node_modules/axios/lib/helpers/validator.js +105 -0
- package/node_modules/axios/lib/utils.js +1 -3
- package/node_modules/axios/package.json +19 -21
- package/node_modules/follow-redirects/debug.js +2 -1
- package/node_modules/follow-redirects/index.js +14 -7
- package/node_modules/follow-redirects/package.json +1 -1
- package/node_modules/mime-db/HISTORY.md +6 -0
- package/node_modules/mime-db/db.json +39 -1
- package/node_modules/mime-db/package.json +4 -4
- package/node_modules/mime-types/HISTORY.md +7 -0
- package/node_modules/mime-types/package.json +4 -4
- package/node_modules/{http2-wrapper/node_modules/quick-lru → quick-lru}/index.d.ts +0 -0
- package/node_modules/{http2-wrapper/node_modules/quick-lru → quick-lru}/index.js +0 -0
- package/node_modules/{http2-wrapper/node_modules/quick-lru → quick-lru}/license +0 -0
- package/node_modules/{http2-wrapper/node_modules/quick-lru → quick-lru}/package.json +0 -0
- package/node_modules/{http2-wrapper/node_modules/quick-lru → quick-lru}/readme.md +0 -0
- package/node_modules/resolve-alpn/README.md +8 -1
- package/node_modules/resolve-alpn/index.js +14 -4
- package/node_modules/resolve-alpn/package.json +1 -1
- package/package.json +15 -15
- package/node_modules/@slack/logger/node_modules/@types/node/base.d.ts +0 -19
- package/node_modules/@slack/logger/node_modules/@types/node/diagnostic_channel.d.ts +0 -38
- package/node_modules/@slack/logger/node_modules/@types/node/ts3.6/assert.d.ts +0 -98
- package/node_modules/@slack/logger/node_modules/@types/node/ts3.6/base.d.ts +0 -67
- package/node_modules/@slack/logger/node_modules/@types/node/ts3.6/index.d.ts +0 -7
- package/node_modules/@slack/web-api/node_modules/@types/node/base.d.ts +0 -19
- package/node_modules/@slack/web-api/node_modules/@types/node/diagnostic_channel.d.ts +0 -38
- package/node_modules/@slack/web-api/node_modules/@types/node/ts3.6/assert.d.ts +0 -98
- package/node_modules/@slack/web-api/node_modules/@types/node/ts3.6/base.d.ts +0 -67
- package/node_modules/@slack/web-api/node_modules/@types/node/ts3.6/index.d.ts +0 -7
- package/node_modules/@types/cacheable-request/node_modules/@types/node/base.d.ts +0 -19
- package/node_modules/@types/cacheable-request/node_modules/@types/node/diagnostic_channel.d.ts +0 -38
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts3.6/assert.d.ts +0 -98
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts3.6/base.d.ts +0 -67
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts3.6/index.d.ts +0 -7
- package/node_modules/@types/is-stream/node_modules/@types/node/base.d.ts +0 -19
- package/node_modules/@types/is-stream/node_modules/@types/node/diagnostic_channel.d.ts +0 -38
- package/node_modules/@types/is-stream/node_modules/@types/node/ts3.6/assert.d.ts +0 -98
- package/node_modules/@types/is-stream/node_modules/@types/node/ts3.6/base.d.ts +0 -67
- package/node_modules/@types/is-stream/node_modules/@types/node/ts3.6/index.d.ts +0 -7
- package/node_modules/@types/keyv/node_modules/@types/node/base.d.ts +0 -19
- package/node_modules/@types/keyv/node_modules/@types/node/diagnostic_channel.d.ts +0 -38
- package/node_modules/@types/keyv/node_modules/@types/node/ts3.6/assert.d.ts +0 -98
- package/node_modules/@types/keyv/node_modules/@types/node/ts3.6/base.d.ts +0 -67
- package/node_modules/@types/keyv/node_modules/@types/node/ts3.6/index.d.ts +0 -7
- package/node_modules/@types/responselike/node_modules/@types/node/base.d.ts +0 -19
- package/node_modules/@types/responselike/node_modules/@types/node/diagnostic_channel.d.ts +0 -38
- package/node_modules/@types/responselike/node_modules/@types/node/ts3.6/assert.d.ts +0 -98
- package/node_modules/@types/responselike/node_modules/@types/node/ts3.6/base.d.ts +0 -67
- package/node_modules/@types/responselike/node_modules/@types/node/ts3.6/index.d.ts +0 -7
|
@@ -1,6 +1,15 @@
|
|
|
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
|
+
*/
|
|
1
11
|
declare module 'util' {
|
|
2
|
-
import * as types from 'util/types';
|
|
3
|
-
|
|
12
|
+
import * as types from 'node:util/types';
|
|
4
13
|
export interface InspectOptions {
|
|
5
14
|
/**
|
|
6
15
|
* If set to `true`, getters are going to be
|
|
@@ -41,24 +50,264 @@ declare module 'util' {
|
|
|
41
50
|
compact?: boolean | number | undefined;
|
|
42
51
|
sorted?: boolean | ((a: string, b: string) => number) | undefined;
|
|
43
52
|
}
|
|
44
|
-
|
|
45
53
|
export type Style = 'special' | 'number' | 'bigint' | 'boolean' | 'undefined' | 'null' | 'string' | 'symbol' | 'date' | 'regexp' | 'module';
|
|
46
54
|
export type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => string;
|
|
47
55
|
export interface InspectOptionsStylized extends InspectOptions {
|
|
48
56
|
stylize(text: string, styleType: Style): string;
|
|
49
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
|
+
*/
|
|
50
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
|
+
*/
|
|
51
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
|
+
*/
|
|
52
130
|
export function getSystemErrorMap(): Map<number, [string, string]>;
|
|
53
|
-
|
|
54
|
-
|
|
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
|
+
*/
|
|
55
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
|
+
*/
|
|
56
305
|
export function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
|
|
57
306
|
export function inspect(object: any, options: InspectOptions): string;
|
|
58
307
|
export namespace inspect {
|
|
59
308
|
let colors: NodeJS.Dict<[number, number]>;
|
|
60
309
|
let styles: {
|
|
61
|
-
[K in Style]: string
|
|
310
|
+
[K in Style]: string;
|
|
62
311
|
};
|
|
63
312
|
let defaultOptions: InspectOptions;
|
|
64
313
|
/**
|
|
@@ -67,41 +316,528 @@ declare module 'util' {
|
|
|
67
316
|
let replDefaults: InspectOptions;
|
|
68
317
|
const custom: unique symbol;
|
|
69
318
|
}
|
|
70
|
-
/**
|
|
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
|
+
*/
|
|
71
337
|
export function isArray(object: unknown): object is unknown[];
|
|
72
|
-
/**
|
|
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
|
+
*/
|
|
73
354
|
export function isRegExp(object: unknown): object is RegExp;
|
|
74
|
-
/**
|
|
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
|
+
*/
|
|
75
371
|
export function isDate(object: unknown): object is Date;
|
|
76
|
-
/**
|
|
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
|
+
*/
|
|
77
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
|
+
*/
|
|
78
460
|
export function inherits(constructor: unknown, superConstructor: unknown): void;
|
|
79
|
-
export
|
|
80
|
-
|
|
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
|
+
*/
|
|
81
539
|
export function isBoolean(object: unknown): object is boolean;
|
|
82
|
-
/**
|
|
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
|
+
*/
|
|
83
556
|
export function isBuffer(object: unknown): object is Buffer;
|
|
84
|
-
/**
|
|
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
|
+
*/
|
|
85
576
|
export function isFunction(object: unknown): boolean;
|
|
86
|
-
/**
|
|
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
|
+
*/
|
|
87
593
|
export function isNull(object: unknown): object is null;
|
|
88
|
-
/**
|
|
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
|
+
*/
|
|
89
611
|
export function isNullOrUndefined(object: unknown): object is null | undefined;
|
|
90
|
-
/**
|
|
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
|
+
*/
|
|
91
630
|
export function isNumber(object: unknown): object is number;
|
|
92
|
-
/**
|
|
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
|
+
*/
|
|
93
650
|
export function isObject(object: unknown): boolean;
|
|
94
|
-
/**
|
|
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
|
+
*/
|
|
95
679
|
export function isPrimitive(object: unknown): boolean;
|
|
96
|
-
/**
|
|
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
|
+
*/
|
|
97
698
|
export function isString(object: unknown): object is string;
|
|
98
|
-
/**
|
|
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
|
+
*/
|
|
99
715
|
export function isSymbol(object: unknown): object is symbol;
|
|
100
|
-
/**
|
|
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
|
+
*/
|
|
101
733
|
export function isUndefined(object: unknown): object is undefined;
|
|
102
|
-
|
|
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
|
+
*/
|
|
103
791
|
export function isDeepStrictEqual(val1: unknown, val2: unknown): boolean;
|
|
104
|
-
|
|
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
|
+
*/
|
|
105
841
|
export function callbackify(fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void;
|
|
106
842
|
export function callbackify<TResult>(fn: () => Promise<TResult>): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
|
107
843
|
export function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void;
|
|
@@ -110,33 +846,100 @@ declare module 'util' {
|
|
|
110
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;
|
|
111
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;
|
|
112
848
|
export function callbackify<T1, T2, T3, TResult>(
|
|
113
|
-
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4
|
|
120
|
-
|
|
121
|
-
|
|
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>
|
|
122
862
|
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
|
123
863
|
export function callbackify<T1, T2, T3, T4, T5, T6>(
|
|
124
|
-
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void
|
|
864
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>
|
|
125
865
|
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void;
|
|
126
866
|
export function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
|
|
127
867
|
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>
|
|
128
868
|
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
|
129
|
-
|
|
130
869
|
export interface CustomPromisifyLegacy<TCustom extends Function> extends Function {
|
|
131
870
|
__promisify__: TCustom;
|
|
132
871
|
}
|
|
133
|
-
|
|
134
872
|
export interface CustomPromisifySymbol<TCustom extends Function> extends Function {
|
|
135
873
|
[promisify.custom]: TCustom;
|
|
136
874
|
}
|
|
137
|
-
|
|
138
875
|
export type CustomPromisify<TCustom extends Function> = CustomPromisifySymbol<TCustom> | CustomPromisifyLegacy<TCustom>;
|
|
139
|
-
|
|
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
|
+
*/
|
|
140
943
|
export function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
|
|
141
944
|
export function promisify<TResult>(fn: (callback: (err: any, result: TResult) => void) => void): () => Promise<TResult>;
|
|
142
945
|
export function promisify(fn: (callback: (err?: any) => void) => void): () => Promise<void>;
|
|
@@ -144,121 +947,617 @@ declare module 'util' {
|
|
|
144
947
|
export function promisify<T1>(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise<void>;
|
|
145
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>;
|
|
146
949
|
export function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2) => Promise<void>;
|
|
147
|
-
export function promisify<T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void):
|
|
148
|
-
(arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>;
|
|
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>;
|
|
149
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>;
|
|
150
952
|
export function promisify<T1, T2, T3, T4, TResult>(
|
|
151
|
-
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void
|
|
953
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void
|
|
152
954
|
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
|
|
153
|
-
export function promisify<T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void):
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void,
|
|
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
|
|
157
958
|
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
|
|
158
959
|
export function promisify<T1, T2, T3, T4, T5>(
|
|
159
|
-
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void
|
|
960
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void
|
|
160
961
|
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
|
|
161
962
|
export function promisify(fn: Function): Function;
|
|
162
963
|
export namespace promisify {
|
|
163
964
|
const custom: unique symbol;
|
|
164
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
|
+
*/
|
|
165
980
|
export class TextDecoder {
|
|
981
|
+
/**
|
|
982
|
+
* The encoding supported by the `TextDecoder` instance.
|
|
983
|
+
*/
|
|
166
984
|
readonly encoding: string;
|
|
985
|
+
/**
|
|
986
|
+
* The value will be `true` if decoding errors result in a `TypeError` being
|
|
987
|
+
* thrown.
|
|
988
|
+
*/
|
|
167
989
|
readonly fatal: boolean;
|
|
990
|
+
/**
|
|
991
|
+
* The value will be `true` if the decoding result will include the byte order
|
|
992
|
+
* mark.
|
|
993
|
+
*/
|
|
168
994
|
readonly ignoreBOM: boolean;
|
|
169
995
|
constructor(
|
|
170
|
-
|
|
171
|
-
|
|
996
|
+
encoding?: string,
|
|
997
|
+
options?: {
|
|
998
|
+
fatal?: boolean | undefined;
|
|
999
|
+
ignoreBOM?: boolean | undefined;
|
|
1000
|
+
}
|
|
172
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
|
+
*/
|
|
173
1010
|
decode(
|
|
174
|
-
|
|
175
|
-
|
|
1011
|
+
input?: NodeJS.ArrayBufferView | ArrayBuffer | null,
|
|
1012
|
+
options?: {
|
|
1013
|
+
stream?: boolean | undefined;
|
|
1014
|
+
}
|
|
176
1015
|
): string;
|
|
177
1016
|
}
|
|
178
|
-
|
|
179
1017
|
export interface EncodeIntoResult {
|
|
180
1018
|
/**
|
|
181
1019
|
* The read Unicode code units of input.
|
|
182
1020
|
*/
|
|
183
|
-
|
|
184
1021
|
read: number;
|
|
185
1022
|
/**
|
|
186
1023
|
* The written UTF-8 bytes of output.
|
|
187
1024
|
*/
|
|
188
1025
|
written: number;
|
|
189
1026
|
}
|
|
190
|
-
|
|
191
1027
|
export { types };
|
|
192
|
-
|
|
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
|
+
*/
|
|
193
1040
|
export class TextEncoder {
|
|
1041
|
+
/**
|
|
1042
|
+
* The encoding supported by the `TextEncoder` instance. Always set to `'utf-8'`.
|
|
1043
|
+
*/
|
|
194
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
|
+
*/
|
|
195
1050
|
encode(input?: string): Uint8Array;
|
|
196
|
-
|
|
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;
|
|
197
1065
|
}
|
|
198
1066
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
export * from 'util';
|
|
1067
|
+
declare module 'util/types' {
|
|
1068
|
+
export * from 'util/types';
|
|
202
1069
|
}
|
|
203
|
-
|
|
204
1070
|
declare module 'util/types' {
|
|
205
|
-
import { KeyObject, webcrypto } from 'crypto';
|
|
206
|
-
|
|
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
|
+
*/
|
|
207
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
|
+
*/
|
|
208
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
|
+
*/
|
|
209
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
|
+
*/
|
|
210
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
|
+
*/
|
|
211
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
|
+
*/
|
|
212
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
|
+
*/
|
|
213
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
|
+
*/
|
|
214
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
|
+
*/
|
|
215
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
|
+
*/
|
|
216
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
|
+
*/
|
|
217
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
|
+
*/
|
|
218
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
|
+
*/
|
|
219
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
|
+
*/
|
|
220
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
|
+
*/
|
|
221
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
|
+
*/
|
|
222
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
|
+
*/
|
|
223
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
|
+
*/
|
|
224
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
|
+
*/
|
|
225
1328
|
function isInt32Array(object: unknown): object is Int32Array;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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
|
+
*/
|
|
233
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
|
+
*/
|
|
234
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
|
+
*/
|
|
235
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
|
+
*/
|
|
236
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
|
+
*/
|
|
237
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
|
+
*/
|
|
238
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
|
+
*/
|
|
239
1414
|
function isRegExp(object: unknown): object is RegExp;
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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
|
+
*/
|
|
247
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
|
+
*/
|
|
248
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
|
+
*/
|
|
249
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
|
+
*/
|
|
250
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
|
+
*/
|
|
251
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
|
+
*/
|
|
252
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
|
+
*/
|
|
253
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
|
+
*/
|
|
254
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
|
+
*/
|
|
255
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
|
+
*/
|
|
256
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
|
+
*/
|
|
257
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
|
+
*/
|
|
258
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
|
+
*/
|
|
259
1556
|
function isCryptoKey(object: unknown): object is webcrypto.CryptoKey;
|
|
260
1557
|
}
|
|
261
|
-
|
|
1558
|
+
declare module 'node:util' {
|
|
1559
|
+
export * from 'util';
|
|
1560
|
+
}
|
|
262
1561
|
declare module 'node:util/types' {
|
|
263
1562
|
export * from 'util/types';
|
|
264
1563
|
}
|