Dump (and pretty print) all function arguments to the console

in code


A Lodash-infused variant of this function is my lifeline at work (ALL the ES6 syntaxes!):

function dump() {
    [...arguments].forEach(arg => {
        console.log(JSON.stringify(arg, null, '\t'));
    });
}

For example:

dump(
  { messages: { hello: 'World!', goodbye: 'Moon!' } },
  ['Apples', 'Oranges', 'Peaches', 'Pears']
);

{
  "messages": {
    "hello": "World!",
    "goodbye": "Moon!"
  }
}

[
  "Apples",
  "Oranges",
  "Peaches",
  "Pears"
]


Remap a JavaScript Object

in code

Blog Silence

in me

Run Clare 2019 Race Series

in running


Your email address will not be published. Required fields are marked *