Skip to content

Commit

Permalink
Fix parseInt() radix issue, closes #80
Browse files Browse the repository at this point in the history
  • Loading branch information
chriso committed Jun 5, 2012
1 parent 336681d commit a3ccb72
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/filter.js
Expand Up @@ -74,8 +74,7 @@ Filter.prototype.toFloat = function() {
}

Filter.prototype.toInt = function(radix) {
radix = radix || 10;
this.modify(parseInt(this.str*1, radix));
this.modify(parseInt(this.str, radix || 10));
return this.wrap(this.str);
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{ "name" : "validator",
"description" : "Data validation, filtering and sanitization for node.js",
"version" : "0.4.6-2",
"version" : "0.4.6-3",
"homepage" : "http://github.com/chriso/node-validator",
"keywords" : ["validator", "validation", "assert", "params", "sanitization", "xss", "entities", "sanitize", "sanitisation", "input"],
"author" : "Chris O'Hara <cohara87@gmail.com>",
Expand Down
1 change: 1 addition & 0 deletions test/filter.test.js
Expand Up @@ -100,6 +100,7 @@ module.exports = {

'test #toInt()': function () {
assert.ok(3 === Filter.sanitize('3').toInt());
assert.ok(255 === Filter.sanitize('ff').toInt(16));
assert.ok(3 === Filter.sanitize(' 3 ').toInt());
},

Expand Down

0 comments on commit a3ccb72

Please sign in to comment.