queckezz / fmt-obj

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

pretty-format #1

Open jamiebuilds opened 7 years ago

jamiebuilds commented 7 years ago

Hey, I wrote a package a little while back called pretty-format. I was wondering if you'd seen it and if there was something it does not do you wish it did.

https://github.com/facebook/jest/tree/master/packages/pretty-format

queckezz commented 7 years ago

Oh this looks rad! No I haven't actually seen it. It also seems like it does support symbols and weak maps/sets which mine currently does not. Def. could have saved some time

jamiebuilds commented 7 years ago

Haha, yeah– discovery can be a hard problem.

I'd love to see what you think of it some more. I focused a lot on trying to make it really performant (currently faster than V8's JSON.stringify and node's debug inspect). Also supporting all the possible types and having very consistent output (for use in Jest's snapshots).

queckezz commented 7 years ago

I see that you put in a lot of thought into it. For example, you defer coloring until later so you can test the output. My primary goal was just to display small json compatible objects to the screen and have them colored for things like http response bodies.

However, one thing thats missing for me in pretty-format is to be able to have more customization regarding the styling/color. In fmt-obj you can differentiate between a bunch of different tokens like punctuation, literals numbers, strings etc. Not sure if that's the scope of the package though.

Also added (2b56739767954af3a1d9a95b261deccf6edf91d6) pretty-format to the readme now. :sparkles:

jamiebuilds commented 7 years ago

We can definitely work on pretty-format to support what you're suggesting if you would like