From c2ceb15fd5524871b6d1b02ec67aebb415b934b9 Mon Sep 17 00:00:00 2001 From: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> Date: Sat, 27 Jun 2020 15:40:00 +0200 Subject: [PATCH] =?UTF-8?q?util:=20add=C2=A0`util/types`=20alias=C2=A0modu?= =?UTF-8?q?le?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs: https://github.com/nodejs/node/pull/31553 Refs: https://github.com/nodejs/node/pull/32953 Refs: https://github.com/nodejs/node/pull/33950 Refs: https://github.com/nodejs/node/pull/34001 Refs: https://github.com/nodejs/node/pull/34002 PR-URL: https://github.com/nodejs/node/pull/34055 Refs: https://github.com/nodejs/node/pull/34962 Reviewed-By: James M Snell Reviewed-By: Michaƫl Zasso Reviewed-By: Myles Borins Reviewed-By: Ruben Bridgewater Reviewed-By: Rich Trott Reviewed-By: Joyee Cheung --- doc/api/util.md | 6 ++++++ lib/util/types.js | 3 +++ node.gyp | 1 + test/es-module/test-esm-util-types.mjs | 6 ++++++ test/parallel/test-util-types-exists.js | 6 ++++++ 5 files changed, 22 insertions(+) create mode 100644 lib/util/types.js create mode 100644 test/es-module/test-esm-util-types.mjs create mode 100644 test/parallel/test-util-types-exists.js diff --git a/doc/api/util.md b/doc/api/util.md index 063239c241e466..134e263f005299 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -1290,6 +1290,10 @@ The encoding supported by the `TextEncoder` instance. Always set to `'utf-8'`. ## `util.types` `util.types` provides type checks for different kinds of built-in objects. @@ -1301,6 +1305,8 @@ The result generally does not make any guarantees about what kinds of properties or behavior a value exposes in JavaScript. They are primarily useful for addon developers who prefer to do type checking in JavaScript. +The API is accessible via `require('util').types` or `require('util/types')`. + ### `util.types.isAnyArrayBuffer(value)`