Node: Control depth when logging objects

For debugging it’s often useful to do console.log(someObjectOrArray). However, if the array is long or the object deep, a lot will be truncated. Apparently there’s a util one can use to get a bit more control over this though:

import util from 'util'

  util.inspect(someObjectOrArray, {
    colors: true,
    depth: 3,
    compact: false,