I am accessing a module from the node.js 's require cache. But it is returning a circular JSON structure. I want to access the exports property of the module. Please help :
var moduleDef = require.cache[moduleName];
console.log(moduleDef) // Prints fine
console.log(moduleDef.exports) // returns undefined
JSON.stringify(moduleDef.exports, function( key, value) {
if(key == 'moduleName') {
return value.id;
} else {
return value;
};
})
如果您只需要查看圆形对象的内容,只需使用 console.table(yourObj)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.