fmt-obj
Prettifies any javascript object in your console. Make it look awesome! :lipstick:
Screenshot
View Example
Installation
npm install --save fmt-obj
Or even better
yarn add fmt-obj
Import and Usage Example
const format = require('fmt-obj')
console.log(format({
message: 'hello world',
dev: true,
awesomeness: 9.99,
body: {
these: null,
are: 'string',
some: 12,
props: false
}
}))
API
fmtObj(obj, depth = infinity, colors = defaultColorMap, offset = 2)
Prettifies obj
given a colors
map with optional depth
.
depth
Objects deeper than depth
will get collapsed and hide their sub properties.
colors
fmt-obj
uses chalk
behind the scenes. Tweak it to your likes.
{
punctuation: chalk.yellow,
property: chalk.green,
literal: chalk.magenta,
number: chalk.cyan,
string: chalk.bold
}
Author
fmt-obj © Fabian Eichenberger, Released under the MIT License.
Authored and maintained by Fabian Eichenberger with help from contributors (list).
GitHub @queckezz · Twitter @queckezz