jest-localstorage-mock
jest-localstorage-mock copied to clipboard
Prevent key conflict and keep iterable behavior
This fixes #102.
Based on #66 I changed the current implementation of the LocalStorage
class to be a factory function that uses a Proxy internally.
This way we avoid key conflicts and keeps the iterable behavior.
So given the storage
object, we can call Object.entries/keys/values
or even just call the storage
object itself that it will resolve to an object with all and just the stored items in it, as the native implementation does.
This looks great at first pass! Lemme figure out what's going on with Circle and get back to this
Cool, thanks!
Do you think we should remove localStorage.__STORE__[<key>]
references from the README and encourage people to use localStorage[<key>]
?
Yes!
Sent from my phone
On May 8, 2019, at 12:49 PM, Iago Dahlem Lorensini [email protected] wrote:
Cool, thanks!
Do you think we should remove localStorage.STORE[
] references from the README and encourage people to use localStorage[ ]? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
@clarkbw any updates?