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

Falsy values are converted to null #121

Closed
simplesmiler opened this issue Sep 4, 2018 · 2 comments · Fixed by #122
Closed

Falsy values are converted to null #121

simplesmiler opened this issue Sep 4, 2018 · 2 comments · Fixed by #122
Labels
bug Bug or defect
Milestone

Comments

@simplesmiler
Copy link
Contributor

When you set a falsy value (0, '', false, etc.), you will get null instead of the value.

Example:

request.yar.set('visits', 1);
console.log(request.yar.get('visits')); // logs 1

request.yar.set('visits', 0);
console.log(request.yar.get('visits')); // logs null

Version: 9.0.1
Happens in this line https://github.com/hapijs/yar/blob/v9.0.1/lib/index.js#L155

If this is not an expected behavior, ping me and I will make a PR.

@hueniverse
Copy link
Contributor

Seems like a bug. PR would be great.

@hueniverse hueniverse added the bug Bug or defect label Sep 5, 2018
simplesmiler added a commit to simplesmiler/yar that referenced this issue Sep 9, 2018
@hueniverse hueniverse added this to the 9.0.2 milestone Sep 23, 2018
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug or defect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants