cferdinandi/bin

myBin.get() returns undefined and removes localStorage item

Opened this issue · 0 comments

If I create a new Bin with no expiry and set it, getting it returns undefined and immediately removes the localStorage item.

https://codepen.io/blakewatson/pen/GRQLZjr?editors=1012

I think the problem is here: https://github.com/cferdinandi/bin/blob/master/src/bin.js#L51

this.expires is undefined, which returns false from isValid's check for null. I’m thinking that line was supposed to use data.expires so that the value would be null and thus isValid would return true.