medikoo / memoizee

Complete memoize/cache solution for JavaScript
ISC License
1.73k stars 61 forks source link

feat: let default nomalizer be more general #122

Open jjangga0214 opened 3 years ago

jjangga0214 commented 3 years ago

Hi.

Currently, the default normalizer covers quite narrow cases only. So, if argument(s) is(are) object(s) (including array), users have to specify a normalizer.

However, in fact, many more objects, which current default normalizer cannot cover, can be serialized without extra configuration. For example, we can use https://github.com/yahoo/serialize-javascript for new default nomalizer. (This would be a better default choice compared to JSON.stringify or so.)

Sane default options would be convenient for users.

How do you think?

Thanks.

medikoo commented 3 years ago

@jjangga0214 thanks for openning that. Any change in defaults is technically a breaking change.

I'm open to that. Still have you checked the proposal for v1: https://github.com/medikoo/memoizee/issues/73 ? It doesn't propose to serialize to JSON by default, but it's scheduled to be behind straightforward serialize: true option