lmaccherone / node-localstorage

A drop-in substitute for the browser native localStorage API that runs on node.js.
MIT License
450 stars 36 forks source link

empty key #46

Closed appy-one closed 4 years ago

appy-one commented 4 years ago

When storing a value with an empty key, it is persisted as "---.EMPTY_STRING.---". When iterating through the keys using .length and .key(i), a key with name "---.EMPTY_STRING.---" is returned instead of "".

let localStorage = new LocalStorage("./scratch"); localStorage.setItem("", "my value"); let key = localStorage.key(0); // "---.EMPTY_STRING.---"

lmaccherone commented 4 years ago

Good catch and pretty easy to fix. I'll try to work on it today.

lmaccherone commented 4 years ago

Fixed and published. It was even easier than I thought.