InspectOptions interface
屬性
| break |
輸入值分割到多行的長度。
設定為 |
| colors | 如果 |
| compact | 將此設定為 |
| custom |
如果 |
| depth | 指定格式化物件時要遞歸的次數。
這對於檢查大型物件很有用。
若要遞迴至呼叫堆疊大小上限 |
| getters | 如果設定為 |
| max |
指定格式化時要包含的 |
| max |
指定格式化時要包含的最大字元數。 設定為 [ |
| numeric |
如果設定為 |
| show |
如果 |
| show |
如果 |
| sorted | 如果設定為 |
屬性詳細資料
breakLength
輸入值分割到多行的長度。
設定為 Infinity,將輸入格式化為單行(結合 compact 設定為 true 或任何數位 >= 1)。
breakLength?: number
屬性值
number
colors
如果 true,輸出會以 ANSI 色彩代碼設定樣式。 色彩是可自定義的。
colors?: boolean
屬性值
boolean
compact
將此設定為 false 會導致每個物件索引鍵顯示在新行上。 它也會將新行新增至超過 breakLength的文字。 如果設定為數位,只要所有屬性都符合 n,最 breakLength 內部元素會統一在單一行上。 簡短陣元素也會分組在一起。 請注意,不論 breakLength 大小為何,都不會減少 16 個字元以下的文字。
如需詳細資訊,請參閱下列範例。
compact?: number | boolean
屬性值
number | boolean
customInspect
如果 false,則不會叫用 [util.inspect.custom](depth, opts, inspect) 函式。
customInspect?: boolean
屬性值
boolean
depth
指定格式化物件時要遞歸的次數。
這對於檢查大型物件很有用。
若要遞迴至呼叫堆疊大小上限 Infinity 或 null。
depth?: null | number
屬性值
null | number
getters
如果設定為 true,也會檢查 getter。 如果設定為 'get' 只會檢查不含 setter 的 getter。 如果設定為 'set' 只會檢查具有對應 setter 的 getter。 這可能會根據 getter 函式造成副作用。
getters?: boolean | "set" | "get"
屬性值
boolean | "set" | "get"
maxArrayLength
指定格式化時要包含的 Array、TypedArray、WeakMap和 WeakSet 元素數目上限。 設定為 [null] 或 [Infinity] 以顯示所有元素。
設定為 0 或負數,以顯示沒有元素。
maxArrayLength?: null | number
屬性值
null | number
maxStringLength
指定格式化時要包含的最大字元數。 設定為 [null] 或 [Infinity] 以顯示所有元素。
設定為 0 或負數,表示不顯示任何字元。
maxStringLength?: null | number
屬性值
null | number
numericSeparator
如果設定為 true,則會使用底線分隔所有 bigint 和 numbers 中的每三位數。
numericSeparator?: boolean
屬性值
boolean
showHidden
如果 true, 物件的不可列舉符號和屬性會包含在格式化的結果中。
也會包含 WeakMap 和 WeakSet 專案,以及使用者定義的原型屬性(不包括方法屬性)。
showHidden?: boolean
屬性值
boolean
showProxy
如果 true,Proxy 檢查會包含目標和處理程序物件。
showProxy?: boolean
屬性值
boolean
sorted
如果設定為 true 或函式,則物件的所有屬性,並在產生的字元串中排序 Set 和 Map 專案。
如果設定為 true 則會使用預設排序。
如果設定為函式,則會作為比較函式使用。
sorted?: boolean | (a: string, b: string) => number
屬性值
boolean | (a: string, b: string) => number