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

Already on GitHub? Sign in to your account

type conversion on boolean variables #6

Open
robinrossow opened this Issue Sep 4, 2012 · 2 comments

Comments

Projects
None yet
3 participants

hey,
I just encountered the problem that a boolean false got converted to the string "false" using your sanitize function:

console.log(typeof(worldhit));
> boolean
console.log(typeof(sanitizer.sanitize(worldhit)));
> string

the value of the variable is false and since !!"false" === true in javascript, it is always interpreted as true.

Contributor

masumsoft commented Dec 24, 2014

Similar problems happening for undefined variables. If I pass an undefined variable, it makes it string "undefined" and all my if(variable) checks afterwards became broken.

Working on a pull request.

Owner

theSmaw commented Dec 15, 2015

Fixed (finally 😉 ) and released in 0.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment