util.types
util.types 提供了对不同类型内置对象的类型检查。与 instanceof 或 Object.prototype.toString.call(value) 不同,这些检查不会检查从 JavaScript 可访问的对象属性(例如它们的原型),并且通常具有调用 C++ 的开销。
结果通常不保证值在 JavaScript 中会暴露出什么样的属性或行为。它们主要对那些倾向于在 JavaScript 中进行类型检查的插件开发者有用。
【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.】
可以通过 require('node:util').types 或 require('node:util/types') 访问该 API。
【The API is accessible via require('node:util').types or require('node:util/types').】