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 · 1 comment
Closed

Falsy values are converted to null #121

simplesmiler opened this issue Sep 4, 2018 · 1 comment
Labels
bug
Milestone

Comments

@simplesmiler
Copy link
Contributor

@simplesmiler simplesmiler commented Sep 4, 2018

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

This comment has been minimized.

Copy link
Member

@hueniverse hueniverse commented Sep 5, 2018

Seems like a bug. PR would be great.

@hueniverse hueniverse added the bug 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.