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:
parent
88b4e2fc19
commit
ca4d835129
@ -7,11 +7,7 @@ var cls = require('./class')
|
||||
, d = require('./dom');
|
||||
|
||||
exports.toInt = function (x) {
|
||||
if (typeof x === 'string') {
|
||||
return parseInt(x, 10) || 0;
|
||||
} else {
|
||||
return ~~x;
|
||||
}
|
||||
return parseInt(x, 10) || 0;
|
||||
};
|
||||
|
||||
exports.clone = function (obj) {
|
||||
|
Loading…
Reference in New Issue
Block a user