From 1f7a724dedde9503e0742f8874ec78dcb51cb940 Mon Sep 17 00:00:00 2001 From: shiin Date: Mon, 30 Jul 2012 14:39:01 +0200 Subject: [PATCH] added function to check whether a variable holds a number --- WebContent/utils/OSRM.Utils.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/WebContent/utils/OSRM.Utils.js b/WebContent/utils/OSRM.Utils.js index 74cfbf2e9..c3935ce57 100644 --- a/WebContent/utils/OSRM.Utils.js +++ b/WebContent/utils/OSRM.Utils.js @@ -77,6 +77,9 @@ isLongitude: function(value) { return true; else return false; +}, +isNumber: function(n) { + return !isNaN(parseFloat(n)) && isFinite(n); } }; \ No newline at end of file