Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catching value of undefined from localStorage.getItem #36

Closed
wants to merge 1 commit into from

Conversation

SilVdB
Copy link

@SilVdB SilVdB commented Aug 29, 2016

Ran into this when trying to test modules that use Lockr: when localStorage is not available, a JSON.parse of localStorage.getItem() returns undefined, not null.

@tsironis
Copy link
Owner

Hello @SilVdB and thank you for your contribution. Is this causing third party libraries to crash? If yes, let's find a test case that fails and confirm that this actually solves the problem.

Copy link

@kounelios13 kounelios13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just !value will do the job.No need for value === null since its covered by !value due to its falsy value

@tsironis
Copy link
Owner

@kounelios13 that's right, I've coded this a while back and it's not bulletproof. Thanks @SilVdB for the catch.

Can you update the code in your pull request in order to merge?

@tsironis
Copy link
Owner

Actually PR #53 solves of these issues so I'm going to accept that instead. Thank you.

@tsironis tsironis closed this Sep 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants