ghtml 3.0.4 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/html.js +12 -8
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Replace your template engine with fast JavaScript by leveraging the power of tagged templates.",
4
4
  "author": "Gürgün Dayıoğlu",
5
5
  "license": "MIT",
6
- "version": "3.0.4",
6
+ "version": "3.0.5",
7
7
  "type": "module",
8
8
  "bin": "./bin/src/index.js",
9
9
  "main": "./src/index.js",
package/src/html.js CHANGED
@@ -14,25 +14,29 @@ const escapeFunction = (string) => {
14
14
  switch (string.charCodeAt(i)) {
15
15
  case 34: // "
16
16
  escaped += string.slice(start, i) + """;
17
- break;
17
+ start = escapeRegExp.lastIndex;
18
+ continue;
18
19
  case 38: // &
19
20
  escaped += string.slice(start, i) + "&";
20
- break;
21
+ start = escapeRegExp.lastIndex;
22
+ continue;
21
23
  case 39: // '
22
24
  escaped += string.slice(start, i) + "'";
23
- break;
25
+ start = escapeRegExp.lastIndex;
26
+ continue;
24
27
  case 60: // <
25
28
  escaped += string.slice(start, i) + "&#60;";
26
- break;
29
+ start = escapeRegExp.lastIndex;
30
+ continue;
27
31
  case 61: // =
28
32
  escaped += string.slice(start, i) + "&#61;";
29
- break;
33
+ start = escapeRegExp.lastIndex;
34
+ continue;
30
35
  case 62: // >
31
36
  escaped += string.slice(start, i) + "&#62;";
32
- break;
37
+ start = escapeRegExp.lastIndex;
38
+ continue;
33
39
  }
34
-
35
- start = escapeRegExp.lastIndex;
36
40
  } while (escapeRegExp.test(string));
37
41
 
38
42
  return escaped + string.slice(start);