queckezz / fmt-obj

Stringifies any javascript object in your console for CLI inspection :sparkles:
MIT License
444 stars 16 forks source link

2 minor things #6

Closed jd327 closed 7 years ago

jd327 commented 7 years ago
  1. Shouldn't readme customFormat example contain Infinity as the 2nd param?

    const customFormat = (...args) => format(...args, Infinity, {
    punctuation: chalk.cyan,
    annotation: chalk.red,
    property: chalk.yellow,
    literal: chalk.blue,
    number: chalk.green,
    string: chalk.bold
    })
  2. If you don't provide one of the color properties, it throws this. Can you merge with the default object?

TypeError: formatter.punctuation is not a function
    at .../node_modules/fmt-obj/dist.js:82:114
queckezz commented 7 years ago

Yea I think the API was pretty flawed. If you want custom formatting you now have to import createFormatter(). It also now merges the default configuration so it shouldn't throw at you anymore.

const { createFormatter } = require('fmt-obj')

const format = createFormatter({
  annotation: chalk.red.bold.italic.whatever
})