is-numeric
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -5,3 +5,6 @@ (function(root) { | ||
function isNumeric(v) { | ||
return !isNaN(v); | ||
if (typeof v === 'number') return true; | ||
var s = v.toString(); | ||
if (!s) return false; | ||
return !isNaN(s); | ||
} | ||
@@ -8,0 +11,0 @@ |
{ | ||
"name": "is-numeric", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Predicate that returns true for numeric values.", | ||
@@ -5,0 +5,0 @@ "main": "is-numeric.js", |
@@ -45,2 +45,9 @@ # is-numeric | ||
console.log(isNumeric('10px')); // false | ||
console.log(isNumeric('*')); // false | ||
console.log(isNumeric('')); // false | ||
console.log(isNumeric(true)); // false | ||
console.log(isNumeric(false)); // false | ||
console.log(isNumeric([])); // false | ||
console.log(isNumeric(function(){})); // false | ||
console.log(isNumeric({})); // false | ||
``` | ||
@@ -47,0 +54,0 @@ |
4243
21
63