lucagez / slow-json-stringify

The slowest stringifier in the known universe. Just kidding, it's the fastest (:
https://github.com/lucagez/slow-json-stringify
MIT License
468 stars 17 forks source link

[Feature request]: Default value? #27

Closed dalisoft closed 3 years ago

dalisoft commented 3 years ago

Hi @lucagez

Is there any way to set default value if value was not provided? Like attr('string', 'Lorem ipsum')?

lucagez commented 3 years ago

Yes, you can use a custom serializer for that

attr('string', value => value || 'Lorem Ipsum');
dalisoft commented 3 years ago

Thanks @lucagez

Also, i see slow-json-stringify bit slow for Objects, is there any way optimize it?

lucagez commented 3 years ago

@dalisoft I opened a new issue discussing possible performance optimizations here https://github.com/lucagez/slow-json-stringify/issues/28#issue-886290943. Feel free to leave comments/suggestions there.