Simplify parseInt.

Because `~~` isn't necessarily faster than `parseInt` in every browser.
Now I think it'd be better to make it readable and simple.
This commit is contained in:
Hyunje Alex Jun 2015-04-15 21:41:11 +09:00
parent 88b4e2fc19
commit ca4d835129

View File

@ -7,11 +7,7 @@ var cls = require('./class')
, d = require('./dom'); , d = require('./dom');
exports.toInt = function (x) { exports.toInt = function (x) {
if (typeof x === 'string') {
return parseInt(x, 10) || 0; return parseInt(x, 10) || 0;
} else {
return ~~x;
}
}; };
exports.clone = function (obj) { exports.clone = function (obj) {