From 96741e1f0b1d11382643de0c95240044685bb46d Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Fri, 29 May 2015 09:33:29 +0200 Subject: [PATCH] Simplify detection of scientific notation This change allows us to remove some avoidable function calls (specifically to goog.isDef(c) and c.toLowerCase()). Additionally, the new check is simpler to read. --- src/ol/format/wktformat.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ol/format/wktformat.js b/src/ol/format/wktformat.js index 69d4b8cdd1..f6183d72c3 100644 --- a/src/ol/format/wktformat.js +++ b/src/ol/format/wktformat.js @@ -495,15 +495,15 @@ ol.format.WKT.Lexer.prototype.readNumber_ = function() { do { if (c == '.') { decimal = true; - } else if (goog.isDef(c) && c.toLowerCase() == 'e') { + } else if (c == 'e' || c == 'E') { scientificNotation = true; } c = this.nextChar_(); } while ( this.isNumeric_(c, decimal) || - // once c is defined we may have a scientific number indicated by 'e' - // but only if we haven't detected a scientific number before - !scientificNotation && goog.isDef(c) && c.toLowerCase() == 'e' || + // if we haven't detected a scientific number before, 'e' or 'E' + // hint that we should continue to read + !scientificNotation && (c == 'e' || c == 'E') || // once we know that we have a scientific number, both '-' and '+' // are allowed scientificNotation && (c == '-' || c == '+')