changed the toInt()'s function behavior so that it returns 0 on empty strings
This commit is contained in:
parent
7ba25d020c
commit
de32082a62
@ -8,7 +8,7 @@ var cls = require('./class')
|
||||
|
||||
exports.toInt = function (x) {
|
||||
if (typeof x === 'string') {
|
||||
return parseInt(x, 10);
|
||||
return parseInt(x, 10) || 0;
|
||||
} else {
|
||||
return ~~x;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user