Skip to content

Commit

Permalink
Improved builtin float parser
Browse files Browse the repository at this point in the history
  • Loading branch information
tarruda committed Aug 30, 2012
1 parent 8420182 commit 834f657
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/router.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ class Compiler

float: (str, opts) ->
str = str.trim()
if str == '' || isNaN(str) then return null
rv = parseFloat(str)
if ! isFinite(rv) || rv.toString() != str
return null
if opts
if (isFinite(opts.min) && rv < opts.min) ||
(isFinite(opts.max) && rv > opts.max)
Expand Down

0 comments on commit 834f657

Please sign in to comment.