Skip to content

Commit

Permalink
revert: perf: prefer continue
Browse files Browse the repository at this point in the history
  • Loading branch information
gurgunday committed Aug 31, 2024
1 parent 3486942 commit ffaefcf
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,25 @@ const escapeFunction = (string) => {
switch (string.charCodeAt(i)) {
case 34: // "
escaped += string.slice(start, i) + """;
start = escapeRegExp.lastIndex;
continue;
break;
case 38: // &
escaped += string.slice(start, i) + "&";
start = escapeRegExp.lastIndex;
continue;
break;
case 39: // '
escaped += string.slice(start, i) + "'";
start = escapeRegExp.lastIndex;
continue;
break;
case 60: // <
escaped += string.slice(start, i) + "&#60;";
start = escapeRegExp.lastIndex;
continue;
break;
case 61: // =
escaped += string.slice(start, i) + "&#61;";
start = escapeRegExp.lastIndex;
continue;
break;
case 62: // >
escaped += string.slice(start, i) + "&#62;";
start = escapeRegExp.lastIndex;
continue;
break;
}

start = escapeRegExp.lastIndex;
} while (escapeRegExp.test(string));

return escaped + string.slice(start);
Expand Down

0 comments on commit ffaefcf

Please # to comment.