mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
util: add util/types
alias module
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 <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
parent
6b6bbfe7d0
commit
c2ceb15fd5
@ -1290,6 +1290,10 @@ The encoding supported by the `TextEncoder` instance. Always set to `'utf-8'`.
|
||||
## `util.types`
|
||||
<!-- YAML
|
||||
added: v10.0.0
|
||||
changes:
|
||||
- version: REPLACEME
|
||||
pr-url: https://github.com/nodejs/node/pull/34055
|
||||
description: Exposed as `require('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)`
|
||||
<!-- YAML
|
||||
added: v10.0.0
|
||||
|
3
lib/util/types.js
Normal file
3
lib/util/types.js
Normal file
@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('internal/util/types');
|
1
node.gyp
1
node.gyp
@ -99,6 +99,7 @@
|
||||
'lib/tty.js',
|
||||
'lib/url.js',
|
||||
'lib/util.js',
|
||||
'lib/util/types.js',
|
||||
'lib/v8.js',
|
||||
'lib/vm.js',
|
||||
'lib/wasi.js',
|
||||
|
6
test/es-module/test-esm-util-types.mjs
Normal file
6
test/es-module/test-esm-util-types.mjs
Normal file
@ -0,0 +1,6 @@
|
||||
import '../common/index.mjs';
|
||||
import assert from 'assert';
|
||||
import { types } from 'util';
|
||||
import utilTypes from 'util/types';
|
||||
|
||||
assert.strictEqual(types, utilTypes);
|
6
test/parallel/test-util-types-exists.js
Normal file
6
test/parallel/test-util-types-exists.js
Normal file
@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
assert.strictEqual(require('util/types'), require('util').types);
|
Loading…
Reference in New Issue
Block a user