myBin.get() returns undefined and removes localStorage item
- Dominant language
- JavaScript
- Stars
- 85
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
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`.
Contributor guide
Research direction
Start at src/bin.js line 51 and reproduce the no-expiry case using the linked CodePen. Trace how an undefined expiry is handled by isValid, then verify that creating, setting, and getting a Bin without expiry returns the value and preserves its localStorage item.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100