Search the reference...
/
BuildDocsReferenceGuidesBlogDiscord/node:util/inspectFinspectVcolorsVcustomVdefaultOptionsVreplDefaultsVstylesnamespace
util.inspect { // a: [ [Circular *1] ], // b: { inner: [Circular *2], obj: [Circular *1] } // } ``` The following example inspects all properties of the `util` object: ```js import util from 'node:util'; console.log(util.inspect(util, { showHidden: true, depth: null })); ``` The following example highlights the effect of the `compact` option: ```js import { inspect } from 'node:util'; const o = { a: [1, 2, [[ 'Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit, sed do ' + 'eiusmod \ntempor incididunt ut labore et dolore magna aliqua.', 'test', 'foo']], 4], b: new Map([['za', 1], ['zb', 'test']]), }; console.log(inspect(o, { compact: true, depth: 5, breakLength: 80 })); // { a: // [ 1, // 2, // [ [ 'Lorem ipsum dolor sit amet,\nconsectetur [...]', // A long line // 'test', // 'foo' ] ], // 4 ], // b: Map(2) { 'za' => 1, 'zb' => 'test' } } // Setting `compact` to false or an integer creates more reader friendly output. console.log(inspect(o, { compact: false, depth: 5, breakLength: 80 })); // { // a: [ // 1, // 2, // [ // [ // 'Lorem ipsum dolor sit amet,\n' + // 'consectetur adipiscing elit, sed do eiusmod \n' + // 'tempor incididunt ut labore et dolore magna aliqua.', // 'test', // 'foo' // ] // ], // 4 // ], // b: Map(2) { // 'za' => 1, // 'zb' => 'test' // } // } // Setting `breakLength` to e.g. 150 will print the "Lorem ipsum" text in a // single line. ``` The `showHidden` option allows `WeakMap` and `WeakSet` entries to be inspected. If there are more entries than `maxArrayLength`, there is no guarantee which entries are displayed. That means retrieving the same `WeakSet` entries twice may result in different output. Furthermore, entries with no remaining strong references may be garbage collected at any time. ```js import { inspect } from 'node:util'; const obj = { a: 1 }; const obj2 = { b: 2 }; const weakSet = new WeakSet([obj, obj2]); console.log(inspect(weakSet, { showHidden: true })); // WeakSet { { a: 1 }, { b: 2 } } ``` The `sorted` option ensures that an object's property insertion order does not impact the result of `util.inspect()`. ```js import { inspect } from 'node:util'; import assert from 'node:assert'; const o1 = { b: [2, 3, 1], a: '`a` comes before `b`', c: new Set([2, 3, 1]), }; console.log(inspect(o1, { sorted: true })); // { a: '`a` comes before `b`', b: [ 2, 3, 1 ], c: Set(3) { 1, 2, 3 } } console.log(inspect(o1, { sorted: (a, b) => b.localeCompare(a) })); // { c: Set(3) { 3, 2, 1 }, b: [ 2, 3, 1 ], a: '`a` comes before `b`' } const o2 = { c: new Set([2, 1, 3]), a: '`a` comes before `b`', b: [2, 3, 1], }; assert.strict.equal( inspect(o1, { sorted: true }), inspect(o2, { sorted: true }), ); ``` The `numericSeparator` option adds an underscore every three digits to all numbers. ```js import { inspect } from 'node:util'; const thousand = 1000; const million = 1000000; const bigNumber = 123456789n; const bigDecimal = 1234.12345; console.log(inspect(thousand, { numericSeparator: true })); // 1_000 console.log(inspect(million, { numericSeparator: true })); // 1_000_000 console.log(inspect(bigNumber, { numericSeparator: true })); // 123_456_789n console.log(inspect(bigDecimal, { numericSeparator: true })); // 1_234.123_45 ``` `util.inspect()` is a synchronous method intended for debugging. Its maximum output length is approximately 128 MiB. Inputs that result in longer output will be truncated." data-algolia-static="false" data-algolia-merged="true" data-type="Namespace">function inspect(object: any,showHidden?: boolean,depth?: null | number,color?: boolean): string;The util.inspect() method returns a string representation of object that is intended for debugging. The output of util.inspect may change at any time and should not be depended upon programmatically. Additional options may be passed that alter the result. util.inspect() will use the constructor's name and/or Symbol.toStringTag property to make an identifiable tag for an inspected value.class Foo { get [Symbol.toStringTag]() { return 'bar'; } } class Bar {} const baz = Object.create(null, { [Symbol.toStringTag]: { value: 'foo' } }); util.inspect(new Foo()); // 'Foo [bar] {}' util.inspect(new Bar()); // 'Bar {}' util.inspect(baz); // '[foo] {}' Circular references point to their anchor by using a reference index:import { inspect } from 'node:util'; const obj = {}; obj.a = [obj]; obj.b = {}; obj.b.inner = obj.b; obj.b.obj = obj; console.log(inspect(obj)); // { // a: [ [Circular *1] ], // b: { inner: [Circular *2], obj: [Circular *1] } // } The following example inspects all properties of the util object:import util from 'node:util'; console.log(util.inspect(util, { showHidden: true, depth: null })); The following example highlights the effect of the compact option:import { inspect } from 'node:util'; const o = { a: [1, 2, [[ 'Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit, sed do ' + 'eiusmod \ntempor incididunt ut labore et dolore magna aliqua.', 'test', 'foo']], 4], b: new Map([['za', 1], ['zb', 'test']]), }; console.log(inspect(o, { compact: true, depth: 5, breakLength: 80 })); // { a: // [ 1, // 2, // [ [ 'Lorem ipsum dolor sit amet,\nconsectetur [...]', // A long line // 'test', // 'foo' ] ], // 4 ], // b: Map(2) { 'za' => 1, 'zb' => 'test' } } // Setting `compact` to false or an integer creates more reader friendly output. console.log(inspect(o, { compact: false, depth: 5, breakLength: 80 })); // { // a: [ // 1, // 2, // [ // [ // 'Lorem ipsum dolor sit amet,\n' + // 'consectetur adipiscing elit, sed do eiusmod \n' + // 'tempor incididunt ut labore et dolore magna aliqua.', // 'test', // 'foo' // ] // ], // 4 // ], // b: Map(2) { // 'za' => 1, // 'zb' => 'test' // } // } // Setting `breakLength` to e.g. 150 will print the "Lorem ipsum" text in a // single line. The showHidden option allows WeakMap and WeakSet entries to be inspected. If there are more entries than maxArrayLength, there is no guarantee which entries are displayed. That means retrieving the same WeakSet entries twice may result in different output. Furthermore, entries with no remaining strong references may be garbage collected at any time.import { inspect } from 'node:util'; const obj = { a: 1 }; const obj2 = { b: 2 }; const weakSet = new WeakSet([obj, obj2]); console.log(inspect(weakSet, { showHidden: true })); // WeakSet { { a: 1 }, { b: 2 } } The sorted option ensures that an object's property insertion order does not impact the result of util.inspect().import { inspect } from 'node:util'; import assert from 'node:assert'; const o1 = { b: [2, 3, 1], a: '`a` comes before `b`', c: new Set([2, 3, 1]), }; console.log(inspect(o1, { sorted: true })); // { a: '`a` comes before `b`', b: [ 2, 3, 1 ], c: Set(3) { 1, 2, 3 } } console.log(inspect(o1, { sorted: (a, b) => b.localeCompare(a) })); // { c: Set(3) { 3, 2, 1 }, b: [ 2, 3, 1 ], a: '`a` comes before `b`' } const o2 = { c: new Set([2, 1, 3]), a: '`a` comes before `b`', b: [2, 3, 1], }; assert.strict.equal( inspect(o1, { sorted: true }), inspect(o2, { sorted: true }), ); The numericSeparator option adds an underscore every three digits to all numbers.import { inspect } from 'node:util'; const thousand = 1000; const million = 1000000; const bigNumber = 123456789n; const bigDecimal = 1234.12345; console.log(inspect(thousand, { numericSeparator: true })); // 1_000 console.log(inspect(million, { numericSeparator: true })); // 1_000_000 console.log(inspect(bigNumber, { numericSeparator: true })); // 123_456_789n console.log(inspect(bigDecimal, { numericSeparator: true })); // 1_234.123_45 util.inspect() is a synchronous method intended for debugging. Its maximum output length is approximately 128 MiB. Inputs that result in longer output will be truncated.@param objectAny JavaScript primitive or Object.@returnsThe representation of object.function inspect(object: any,options?: InspectOptions): string;The util.inspect() method returns a string representation of object that is intended for debugging. The output of util.inspect may change at any time and should not be depended upon programmatically. Additional options may be passed that alter the result. util.inspect() will use the constructor's name and/or Symbol.toStringTag property to make an identifiable tag for an inspected value.class Foo { get [Symbol.toStringTag]() { return 'bar'; } } class Bar {} const baz = Object.create(null, { [Symbol.toStringTag]: { value: 'foo' } }); util.inspect(new Foo()); // 'Foo [bar] {}' util.inspect(new Bar()); // 'Bar {}' util.inspect(baz); // '[foo] {}' Circular references point to their anchor by using a reference index:import { inspect } from 'node:util'; const obj = {}; obj.a = [obj]; obj.b = {}; obj.b.inner = obj.b; obj.b.obj = obj; console.log(inspect(obj)); // { // a: [ [Circular *1] ], // b: { inner: [Circular *2], obj: [Circular *1] } // } The following example inspects all properties of the util object:import util from 'node:util'; console.log(util.inspect(util, { showHidden: true, depth: null })); The following example highlights the effect of the compact option:import { inspect } from 'node:util'; const o = { a: [1, 2, [[ 'Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit, sed do ' + 'eiusmod \ntempor incididunt ut labore et dolore magna aliqua.', 'test', 'foo']], 4], b: new Map([['za', 1], ['zb', 'test']]), }; console.log(inspect(o, { compact: true, depth: 5, breakLength: 80 })); // { a: // [ 1, // 2, // [ [ 'Lorem ipsum dolor sit amet,\nconsectetur [...]', // A long line // 'test', // 'foo' ] ], // 4 ], // b: Map(2) { 'za' => 1, 'zb' => 'test' } } // Setting `compact` to false or an integer creates more reader friendly output. console.log(inspect(o, { compact: false, depth: 5, breakLength: 80 })); // { // a: [ // 1, // 2, // [ // [ // 'Lorem ipsum dolor sit amet,\n' + // 'consectetur adipiscing elit, sed do eiusmod \n' + // 'tempor incididunt ut labore et dolore magna aliqua.', // 'test', // 'foo' // ] // ], // 4 // ], // b: Map(2) { // 'za' => 1, // 'zb' => 'test' // } // } // Setting `breakLength` to e.g. 150 will print the "Lorem ipsum" text in a // single line. The showHidden option allows WeakMap and WeakSet entries to be inspected. If there are more entries than maxArrayLength, there is no guarantee which entries are displayed. That means retrieving the same WeakSet entries twice may result in different output. Furthermore, entries with no remaining strong references may be garbage collected at any time.import { inspect } from 'node:util'; const obj = { a: 1 }; const obj2 = { b: 2 }; const weakSet = new WeakSet([obj, obj2]); console.log(inspect(weakSet, { showHidden: true })); // WeakSet { { a: 1 }, { b: 2 } } The sorted option ensures that an object's property insertion order does not impact the result of util.inspect().import { inspect } from 'node:util'; import assert from 'node:assert'; const o1 = { b: [2, 3, 1], a: '`a` comes before `b`', c: new Set([2, 3, 1]), }; console.log(inspect(o1, { sorted: true })); // { a: '`a` comes before `b`', b: [ 2, 3, 1 ], c: Set(3) { 1, 2, 3 } } console.log(inspect(o1, { sorted: (a, b) => b.localeCompare(a) })); // { c: Set(3) { 3, 2, 1 }, b: [ 2, 3, 1 ], a: '`a` comes before `b`' } const o2 = { c: new Set([2, 1, 3]), a: '`a` comes before `b`', b: [2, 3, 1], }; assert.strict.equal( inspect(o1, { sorted: true }), inspect(o2, { sorted: true }), ); The numericSeparator option adds an underscore every three digits to all numbers.import { inspect } from 'node:util'; const thousand = 1000; const million = 1000000; const bigNumber = 123456789n; const bigDecimal = 1234.12345; console.log(inspect(thousand, { numericSeparator: true })); // 1_000 console.log(inspect(million, { numericSeparator: true })); // 1_000_000 console.log(inspect(bigNumber, { numericSeparator: true })); // 123_456_789n console.log(inspect(bigDecimal, { numericSeparator: true })); // 1_234.123_45 util.inspect() is a synchronous method intended for debugging. Its maximum output length is approximately 128 MiB. Inputs that result in longer output will be truncated.@param objectAny JavaScript primitive or Object.@returnsThe representation of object.namespace inspectconst colors: InspectColorsconst custom: unique symbolconst defaultOptions: InspectOptionsconst replDefaults: InspectOptionsconst styles: InspectStylesResources
ReferenceDocsGuidesDiscordMerch StoreGitHubBlogToolkit
RuntimePackage managerTest runnerBundlerPackage runnerProject
Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San FranciscoWe're hiring →智能索引记录
-
2026-02-27 16:05:41
综合导航
成功
标题:Suction Diffuser Plus - HTS Commercial & Industrial HVAC Systems, Parts, & Services Company
简介:The Bell & Gossett Suction Diffuser Plus is an angle pattern
-
2026-02-28 07:10:17
综合导航
成功
标题:Steuerung eines zentralen Distributionszentrums im LEH-Bereich
简介:TUP.WMS ist die zentrale Datendrehscheibe für alle Logistikp
-
2026-02-27 23:40:30
综合导航
成功
标题:Cárdigans y suéteres acogedores: Suéteres de chenilla, extragrandes y más Aerie
简介:Compra suéteres y cárdigans acogedores en Aerie. Presentamos
-
2026-02-27 15:41:52
综合导航
成功
标题:5 Hurdles Facing Marijuana Tax Implementation
简介:States get advice on how to avoid letting new revenue stream
-
2026-02-28 07:20:50
综合导航
成功
标题:AbortSignal.addEventListener method globals module Bun
简介:API documentation for method globals.AbortSignal.addEventLis
-
2026-02-28 07:29:29
综合导航
成功
标题:心沉下去,快乐才会满溢出来-励志一生
简介:作者:卷毛维安 诗歌《于我,过去,现在以及未来》中有一句很经典的话,In me the tiger sniffs the
-
2026-02-27 17:36:11
综合导航
成功
标题:10 Boultbee Ave - HTS Commercial & Industrial HVAC Systems, Parts, & Services Company
简介:10 Boultbee is located in Greektown, one of Toronto’s iconic
-
2026-02-27 22:58:37
综合导航
成功
标题:494040243-1150 Heater Jacket
简介:The 494040243-1150 PTFE-Teflon® Heater Jacket is designed fo
-
2026-02-28 02:33:21
综合导航
成功
标题:Mac - Apple (IT)
简介:I portatili e desktop Mac più potenti di sempre. Con i supe
-
2026-02-28 06:12:31
综合导航
成功
标题:Johann Tzerclaes, Count of Tilly (1559-1632). The Reader's Biographical Encyclopaedia. 1922
简介:Johann Tzerclaes, Count of Tilly (1559-1632). The Reader
-
2026-02-28 05:48:19
教育培训
成功
标题:艺高人胆大的意思解释_艺高人胆大是什么意思-雄安文学网
简介:艺高人胆大是什么意思?雄安文学网为您提供艺高人胆大的意思解释、拼音、近反义词,以及艺高人胆大成语接龙,供成语爱好者参考学
-
2026-02-28 03:25:15
综合导航
成功
标题:多读书吧,活到老,学到老-励志一生
简介:作者:喵姐 1 一直很喜欢安静的图书馆和书店,因为只要用手掌抚摸那些书的脊背,内心便是莫大的宁静。置身那一片书海,外界的
-
2026-02-28 08:05:15
游戏娱乐
成功
标题:beat·365(中国) - 官方网站
简介:⚽️Beat365官方网站即时软件已成为中国网民网上娱乐的主要方式,Beat365官方网站这里聚集了全球各个国家的游戏玩
-
2026-02-28 07:19:21
综合导航
成功
标题:Fire at Longview Country Club Cart Shed—KLOG 100.7 News - Classic Hits 100.7 KLOG
简介:100.7 KLOG - Classic Hits, Local News and Sports
-
2026-02-28 03:50:16
综合导航
成功
标题:利物浦是什么意思_利物浦的词语解释-雄安文学网
简介:利物浦是什么意思?雄安文学网为您提供利物浦的的意思解释,解读利物浦的解释含义,包括基本解释和详细解释等。
-
2026-02-27 16:09:23
综合导航
成功
标题:Free Valentine's Day Coloring Page - Flower Pot with Love Letter EDU.COM
简介:Download this free printable Valentine
-
2026-02-28 09:34:35
新闻资讯
成功
标题:华为发布面向2025年通信能源十大趋势, 站长资讯平台
简介:5G正在加速到来,通信网络将发生三个显著变化:新频新技术引入、站点新增、MEC下沉。同时,随着5G走向千行百业,ICT与
-
2026-02-27 14:20:15
综合导航
成功
标题:Diversion Element (1800-03421) - VTE-FILTER GmbH
简介:Fabricante: VTE Filter N.º OEM: Alfa Laval Moatti 1800-03421
-
2026-02-27 14:51:28
综合导航
成功
标题:Schulmöbel - a2s.com
简介:Entdecken Sie unser vielfältiges Schulmöbel-Sortiment. In De
-
2026-02-28 05:51:49
综合导航
成功
标题:Schaeffler Germany
简介:Schaeffler has been driving forward groundbreaking invention
-
2026-02-28 09:26:12
综合导航
成功
标题:Flug buchen
简介:Buchen Sie Ihren nächsten Flug ab Düsseldorf auf dus.com! A
-
2026-02-28 06:34:18
综合导航
成功
标题:Charlotte Clarke shares how she beats the runner's wall - MP MP Apparel
简介:Feel like you
-
2026-02-28 08:32:46
综合导航
成功
标题:LOVE FAVORITE STICKER – M22
简介:If you LOVE it, show it. On your car, locker, notebook, lapt
-
2026-02-28 09:34:13
综合导航
成功
标题:Node fs.chmodSync function API Reference Bun
简介:API documentation for function node:fs.chmodSync Bun
-
2026-02-28 09:13:28
综合导航
成功
标题:Football Tricks - Play Football Tricks Game Online Free
简介:Play Football Tricks game online for free on YAD. The game i
-
2026-02-27 15:47:28
综合导航
成功
标题:Contact adops.com - PR.com
简介:Contact adops.com via this online contact form.
-
2026-02-27 22:19:22
综合导航
成功
标题:TheDomains.com - Award winning domain name Industry publication on domain news, gTLD's, registrars and registries.
简介:Award winning domain name Industry publication on domain new
-
2026-02-28 07:23:46
综合导航
成功
标题:18luck新利官网利app-你玩乐的的好帮手
简介:18luck新利官网专注于为玩家打造无忧的游戏环境。其官方应用程序以简洁流畅的设计、便捷的操作体验和丰富的游戏内容,成为
-
2026-02-28 07:52:12
综合导航
成功
标题:Заявка на услугу «Доменный брокер» Рег.ру
简介:Отправить заявку на услугу «Доменный брокер».
-
2026-02-27 23:40:46
综合导航
成功
标题:製åå¥å種è¨å®ã»ãå©ç¨ã¬ã¤ã ã¹ãã¼ããã©ã³ã»æºå¸¯é»è©±ããå©ç¨ã®æ¹ au
简介:au製åå¥ã®å種è¨å®ã»ãå©ç¨ã¬ã¤ãã®ãã¼ã¸ã