anywhichway / nano-memoize

Faster than fast, smaller than micro ... a nano speed and size (780 Brotili bytes) memoize for single and multiple argument functions.
MIT License
212 stars 12 forks source link

support zero arg caching. #41

Closed igalklebanov closed 2 years ago

igalklebanov commented 2 years ago

Currently, executing a memoized function with no arguments keeps filling k with {} (arguments) items and v with results of each arg-less invocation, instead of caching. Basically a memory leak.

One would expect vArgs to work with 0 args, as well.

igalklebanov commented 2 years ago

@anywhichway thanks! can you please publish a patch version with these changes?

anywhichway commented 2 years ago

@igalklebanov v1.3.1 published to NPM. Thanks for the improvements.