1.0.3 • Published 2 years ago
@knighted/dump v1.0.3
@knighted/dump
Wrapper around Node's util.inpsect to dump your nested objects to the console.
Example
import { dump } from '@knighted/dump'
const nested = {
knighted: {
code: {
monkey: {
bananas: true
}
}
}
}
dump({
obj: nested,
prefix: 'prefix',
opts: { depth: 3, colors: true }
})Output:
prefix {
knighted: { code: { monkey: { bananas: true } } }
}Or simply use dump.log if not passing opts.
dump.log(nested, 'prefix') // Same output as aboveOptions
objThe object to dumpprefixHelpful hint prefixed to the dumpoptsSame as https://nodejs.org/api/util.html#utilinspectobject-options
dump.log(obj) uses until.inspect(obj, false, null, true).