andreypopp / andreypopp/memoize-decorator

Memoize-decorator doesn't work with frozen objects

Open
#2 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
30
Forks
6
PR merge metrics
No merged PRs in 30d

Description

I'm wondering if you'd be open to using a `Map` instead, if its available (and fall back to the existing implementation). Basically, instead of setting `this[memoizedName]` (which breaks after `Object.freeze(this)`), you could have a nested set of maps, of the type:

`outerMap: Map`
`innerMap: Map`

FWIW, I'm not 100% sure that we need a set of nested maps. Each getter could be a different object on every instance, but I'm assuming that JS reuses the same object.

Happy to make a PR with that.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.