We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2555500 commit 35a2e84Copy full SHA for 35a2e84
src/util.js
@@ -4,13 +4,15 @@ export const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine
4
const ENCODED_ENTITIES = /[&<>"]/;
5
6
export function encodeEntities(str) {
7
- if (ENCODED_ENTITIES.test(s) === false) return s;
+ // Skip all work for strings with no entities needing encoding:
8
+ if (ENCODED_ENTITIES.test(str) === false) return str;
9
+
10
let start = 0,
11
i = 0,
12
out = '',
13
ch = '';
14
for (; i<str.length; i++) {
- switch(str.charCodeAt(i)) {
15
+ switch (str.charCodeAt(i)) {
16
case 60: ch = '<'; break;
17
case 62: ch = '>'; break;
18
case 34: ch = '"'; break;
0 commit comments