bin icon indicating copy to clipboard operation
bin copied to clipboard

myBin.get() returns undefined and removes localStorage item

Open blakewatson opened this issue 2 years ago • 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.

blakewatson avatar Jun 18 '22 03:06 blakewatson