Right now the API distinguishes between "not present" and "has undefined", in the same way that JS maps do.
localStorage only allows string values, so passing undefined is the same as passing "undefined".
localForage seems to convert undefined to null, but then store it anyway.
The alternative is to say that setting an item to undefined (and null?) is equivalent to deleting it. So any values set to undefined would be deleted from the keys/values/entries, in particular.
If we did this, we could also get rid of the has() method, which does not exist in localStorage, and encourages error-prone racy code like
if (await als.has("key")) {
const val = await als.get("key");
// oops, val might have been deleted between the has and the get; the has didn't buy us anything
}
instead encouraging people to do
const val = await als.get("key");
if (val !== undefined) {
// good to go
}
Note that this issue becomes moot if we resolve #2 in favor of restricting values to strings.