Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

isnumeric

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isnumeric - npm Package Compare versions

Comparing version 0.1.5 to 0.2.0

4

isNumeric.js
var isNumeric = function (obj) {
obj = typeof(obj) === "string" ? obj.replace(",", ".") : obj;
obj = typeof(obj) === "string" ? obj.replace(/,/g, "") : obj;
return !isNaN(parseFloat(obj)) && isFinite(obj) && Object.prototype.toString.call(obj).toLowerCase() !== "[object array]";

@@ -11,2 +11,2 @@ };

exports.isNumeric = isNumeric;
}
}
/*!
isnumeric (v0.1.5) 24-02-2015
isnumeric (v0.2.0) 15-04-2015
(c) Lee Crossley <leee@hotmail.co.uk> (http://ilee.co.uk/)
*/
var isNumeric=function(a){return a="string"==typeof a?a.replace(",","."):a,!isNaN(parseFloat(a))&&isFinite(a)&&"[object array]"!==Object.prototype.toString.call(a).toLowerCase()};"undefined"!=typeof exports&&("undefined"!=typeof module&&module.exports&&(exports=module.exports=isNumeric),exports.isNumeric=isNumeric);
var isNumeric=function(a){return a="string"==typeof a?a.replace(/,/g,""):a,!isNaN(parseFloat(a))&&isFinite(a)&&"[object array]"!==Object.prototype.toString.call(a).toLowerCase()};"undefined"!=typeof exports&&("undefined"!=typeof module&&module.exports&&(exports=module.exports=isNumeric),exports.isNumeric=isNumeric);

@@ -6,3 +6,3 @@ {

"homepage": "http://ilee.co.uk",
"version": "0.1.5",
"version": "0.2.0",
"main": "isNumeric.min.js",

@@ -29,5 +29,5 @@ "keywords": [

"grunt-contrib-jshint": "^0.11.0",
"grunt-contrib-uglify": "^0.8.0",
"grunt-contrib-uglify": "^0.9.1",
"grunt-contrib-watch": "^0.6.0"
}
}

@@ -56,2 +56,7 @@ describe("isNumeric", function() {

it("should return true for multiple commas", function() {
expect(isNumeric("1,1,1")).toBeTruthy();
expect(isNumeric("1,1,1,1")).toBeTruthy();
});
it("should return false for empty / whitespace", function() {

@@ -78,3 +83,3 @@ expect(isNumeric()).toBeFalsy();

expect(isNumeric("1.1.1")).toBeFalsy();
expect(isNumeric("1,1,1")).toBeFalsy();
expect(isNumeric("1.1.1.1")).toBeFalsy();
});

@@ -123,2 +128,2 @@

});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc