Skip to content

Commit ef7de43

Browse files
addaleaxBridgeAR
authored andcommitted
util: introduce util.types.is[…] type checks
Provide public APIs for native typechecking that is actually useful. The motivation for this is providing alternatives to userland modules that would currently rely on `process.binding('util')`. PR-URL: nodejs#18415 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
1 parent 5422160 commit ef7de43

File tree

15 files changed

+924
-123
lines changed

15 files changed

+924
-123
lines changed

doc/api/deprecations.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,15 @@ because it also made sense to interpret the value as the number of bytes
814814
read by the engine, but is inconsistent with other streams in Node.js that
815815
expose values under these names.
816816
817+
<a id="DEP0XXX"></a>
818+
### DEP0XXX: process.binding('util').is[...] typechecks
819+
820+
Type: Documentation-only (supports [`--pending-deprecation`][])
821+
822+
Using `process.binding()` in general should be avoided. The type checking
823+
methods in particular can be replaced by using [`util.types`][].
824+
825+
[`--pending-deprecation`]: cli.html#cli_pending_deprecation
817826
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
818827
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array
819828
[`Buffer.from(buffer)`]: buffer.html#buffer_class_method_buffer_from_buffer
@@ -874,6 +883,7 @@ expose values under these names.
874883
[`util.log()`]: util.html#util_util_log_string
875884
[`util.print()`]: util.html#util_util_print_strings
876885
[`util.puts()`]: util.html#util_util_puts_strings
886+
[`util.types`]: util.html#util_util_types
877887
[`util`]: util.html
878888
[`worker.exitedAfterDisconnect`]: cluster.html#cluster_worker_exitedafterdisconnect
879889
[`zlib.bytesWritten`]: zlib.html#zlib_zlib_byteswritten

0 commit comments

Comments
 (0)