Browse Source

Better regex matching

pull/1/head
Matthew Holt 11 years ago
parent
commit
38fa3a4358
  1. 2
      jquery.parse.js

2
jquery.parse.js

@ -258,7 +258,7 @@
function tryParseFloat(num) function tryParseFloat(num)
{ {
var isNumber = num.match(/(\d+)(\.\d+)?|/)[0].length == num.length; var isNumber = /^\d+(\.\d+)?$/.test(num);
return isNumber ? parseFloat(num) : num; return isNumber ? parseFloat(num) : num;
} }

Loading…
Cancel
Save