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.
redux
David Majda 13 years ago
parent c7f99019c2
commit 938f655ccf

@ -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);

Loading…
Cancel
Save