Merge pull request #321 from juxtapos/toInt-fix
changed toInt()'s function behavior
This commit is contained in:
commit
88b4e2fc19
@ -8,7 +8,7 @@ var cls = require('./class')
|
|||||||
|
|
||||||
exports.toInt = function (x) {
|
exports.toInt = function (x) {
|
||||||
if (typeof x === 'string') {
|
if (typeof x === 'string') {
|
||||||
return parseInt(x, 10);
|
return parseInt(x, 10) || 0;
|
||||||
} else {
|
} else {
|
||||||
return ~~x;
|
return ~~x;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user