Skip to content

Instantly share code, notes, and snippets.

@simonplend
Created December 21, 2022 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonplend/8c4fe3c813d0eee01b94c136a94f8da3 to your computer and use it in GitHub Desktop.
Save simonplend/8c4fe3c813d0eee01b94c136a94f8da3 to your computer and use it in GitHub Desktop.
Example showing how to log a large, deep object with infinite depth in Node.js
/**
* This could be any object, perhaps the
* response from a request to an API.
*/
const deepObject = [
{imGoing:{deeperUnderground:{theresToo:{muchPanic:{inThis:{town:["I'm going deeper underground","There's too much panic in this town"]}}}}}},
{wellI:{gotToGo:{deeper:{gotToGo:{muchDeeper:true,theyGonna:{wreckItDown:true,theyGonna:["bring","it","down"]}}}}},rating:100}
];
// @see https://nodejs.org/api/console.html#consoledirobj-options
console.dir(deepObject, { depth: null });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment