Skip to content

Commit

Permalink
reformat switch
Browse files Browse the repository at this point in the history
  • Loading branch information
gurgunday committed Jun 21, 2024
1 parent 8b9cc42 commit 3099efb
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,32 @@ const escapeFunction = (string) => {
let escaped = "";

do {
switch (string.charCodeAt(end++)) {
const charCode = string.charCodeAt(end++);

switch (charCode) {
case 34: // "
escaped += string.slice(start, end - 1) + """;
start = end;
continue;
break;
case 38: // &
escaped += string.slice(start, end - 1) + "&";
start = end;
continue;
break;
case 39: // '
escaped += string.slice(start, end - 1) + "'";
start = end;
continue;
break;
case 60: // <
escaped += string.slice(start, end - 1) + "&#60;";
start = end;
continue;
break;
case 62: // >
escaped += string.slice(start, end - 1) + "&#62;";
start = end;
continue;
break;
case 96: // `
escaped += string.slice(start, end - 1) + "&#96;";
start = end;
break;
default:
continue;
}

start = end;
} while (end !== stringLength);

escaped += string.slice(start, end);
Expand Down

0 comments on commit 3099efb

Please sign in to comment.