fmt-obj icon indicating copy to clipboard operation
fmt-obj copied to clipboard

pretty-format

Open jamiebuilds opened this issue 8 years ago • 4 comments

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

jamiebuilds avatar Feb 16 '17 23:02 jamiebuilds

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

queckezz avatar Feb 17 '17 06:02 queckezz

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).

jamiebuilds avatar Feb 17 '17 06:02 jamiebuilds

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:

queckezz avatar Feb 17 '17 07:02 queckezz

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

jamiebuilds avatar Feb 17 '17 18:02 jamiebuilds