hapijs / yar

A hapi session manager
Other
133 stars 59 forks source link

Falsy values are converted to null #121

Closed simplesmiler closed 5 years ago

simplesmiler commented 6 years ago

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 commented 6 years ago

Seems like a bug. PR would be great.

lock[bot] commented 4 years ago

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.