From 938f655ccfd31fa001bf3c509e14482f03d86e58 Mon Sep 17 00:00:00 2001 From: David Majda Date: Tue, 13 Sep 2011 18:53:27 +0200 Subject: [PATCH] src/utils.js: Fix variable redefinition in |escape| Fixes the following JSHint errors: ./src/utils.js: line 76, col 20, 'escapeChar' is already defined. ./src/utils.js: line 77, col 16, 'length' is already defined. ./src/utils.js: line 80, col 17, 'escapeChar' used out of scope. ./src/utils.js: line 80, col 80, 'length' used out of scope. --- src/utils.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/utils.js b/src/utils.js index f659e74..88b4363 100644 --- a/src/utils.js +++ b/src/utils.js @@ -68,13 +68,15 @@ function padLeft(input, padding, length) { */ function escape(ch) { var charCode = ch.charCodeAt(0); + var escapeChar; + var length; if (charCode <= 0xFF) { - var escapeChar = 'x'; - var length = 2; + escapeChar = 'x'; + length = 2; } else { - var escapeChar = 'u'; - var length = 4; + escapeChar = 'u'; + length = 4; } return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length);