Skip to content

Commit

Permalink
fix: isNumber判断
Browse files Browse the repository at this point in the history
  • Loading branch information
wanghaoo committed Dec 30, 2016
1 parent 5d1e144 commit ff8b74f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/util.js
Expand Up @@ -53,7 +53,8 @@ var isDate = function(input) {
};
var isNumber = function(obj) {
//return obj === +obj
return(obj - parseFloat(obj) + 1) >= 0;
//加了个typeof 判断,因为'431027199110.078573'会解析成number
return (typeof obj ==='number') && (obj - parseFloat(obj) + 1 >= 0);
};
var isArray = Array.isArray || function(val) {
return Object.prototype.toString.call(val) === '[object Array]';
Expand Down

0 comments on commit ff8b74f

Please sign in to comment.