In only a specific object, when I use console.log
or I print the result of util.inspect
I got just the number 1
or 2
as the result.
How do I now that the object printed is not just the number 1
or 2
?
I use the debugger inspector to see the attributes and functions, also it's possible to run some code to check all the members of the object, described in Node.js console.log(object) prints empty object.
NOTE: I tried to clone/copy the object and I'm getting the same behavior, what's is wrong with that object?
I'm using this library: https://hexo.io/
When I tried to use this feature: https://hexo.io/api/renderer.html
Code example:
hexo.extend.renderer.register('some', 'html', function (data, options, callback) {
console.log("Data");
console.log(data); // It works (object is printed sucessfully)
console.log("Options");
console.log(options); // I got "2" printed.
// something unrelated code to use the callback
}, false);
Like I said the object options
have several different members, and is the same/similar behavior with util.inspect
, even if I specified depth and/or other parameters.
My purpose is to find why does it happen, and how to fix it?
EDIT:
In addition, if I try to serialize this object into JSON, using JSON.stringify
, that's the exception that I'll receive:
Unhandled rejection TypeError: Converting circular structure to JSON
at Object.stringify (native)