Format JSON for inspecting objects
This patch enables formatting for inspecting JSON objects. Example: p({foo: "bar", deep: {foo: "bar"}}) becomes: { "foo": "bar", "deep": { "foo": "bar" } }
This commit is contained in:
parent
ca2c7d1745
commit
6e9e61b9df
@ -28,7 +28,7 @@ exports.inspect = function (value) {
|
|||||||
if (value === undefined) return;
|
if (value === undefined) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return JSON.stringify(value);
|
return JSON.stringify(value, undefined, 1);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// TODO make this recusrive and do a partial JSON output of object.
|
// TODO make this recusrive and do a partial JSON output of object.
|
||||||
if (e.message.search("circular")) {
|
if (e.message.search("circular")) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user