changed the toInt()'s function behavior so that it returns 0 on empty strings

This commit is contained in:
Claus Augusti 2015-04-15 13:56:38 +02:00
parent 7ba25d020c
commit de32082a62

View File

@ -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;
} }