In Node.js, you can use util.inspect(object) .
(在Node.js中,可以使用util.inspect(object) 。)
It automatically replaces circular links with "[Circular]". (它会自动将圆形链接替换为“ [Circular]”。)
Albeit being built-in (no installation is required) , you must import it
(尽管是内置的(无需安装) ,但必须将其导入)
import * as util from 'util' // has no default export
import { inspect } from 'util' // or directly
// or
var util = require('util')
To use it, simply call
要使用它,只需调用)
inspect(myObject[, options: {showHidden, depth, colors, showProxy, ...moreOptions}])
Also be aware that you can pass options object to inspect (see link above)
(另外请注意,您可以通过options对象进行检查(请参见上面的链接))
inspect(myObject[, options: {showHidden, depth, colors, showProxy, ...moreOptions}])
Please, read and give kudos to commenters below...
(请阅读下面的评论并将其赞扬...)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…