ghtml 1.7.0 → 1.7.1
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.
- package/package.json +3 -3
- package/src/html.js +6 -4
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": "1.7.
|
|
6
|
+
"version": "1.7.1",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.js",
|
|
9
9
|
"exports": {
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@fastify/pre-commit": "^2.1.0",
|
|
24
24
|
"c8": "^9.1.0",
|
|
25
|
-
"grules": "^0.
|
|
26
|
-
"tinybench": "^2.
|
|
25
|
+
"grules": "^0.17.1",
|
|
26
|
+
"tinybench": "^2.8.0"
|
|
27
27
|
},
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|
package/src/html.js
CHANGED
|
@@ -19,7 +19,6 @@ const escapeFunction = (string) => {
|
|
|
19
19
|
|
|
20
20
|
do {
|
|
21
21
|
const escapedCharacter = escapeDictionary[string[end++]];
|
|
22
|
-
|
|
23
22
|
if (escapedCharacter) {
|
|
24
23
|
escaped += string.slice(start, end - 1) + escapedCharacter;
|
|
25
24
|
start = end;
|
|
@@ -37,10 +36,11 @@ const arrayIsArray = Array.isArray;
|
|
|
37
36
|
* @returns {string} The HTML string.
|
|
38
37
|
*/
|
|
39
38
|
const html = ({ raw: literals }, ...expressions) => {
|
|
39
|
+
const expressionsLength = expressions.length;
|
|
40
40
|
let index = 0;
|
|
41
41
|
let accumulator = "";
|
|
42
42
|
|
|
43
|
-
for (; index !==
|
|
43
|
+
for (; index !== expressionsLength; ++index) {
|
|
44
44
|
const expression = expressions[index];
|
|
45
45
|
let literal = literals[index];
|
|
46
46
|
let string =
|
|
@@ -70,9 +70,10 @@ const html = ({ raw: literals }, ...expressions) => {
|
|
|
70
70
|
* @yields {string} The HTML strings.
|
|
71
71
|
*/
|
|
72
72
|
const htmlGenerator = function* ({ raw: literals }, ...expressions) {
|
|
73
|
+
const expressionsLength = expressions.length;
|
|
73
74
|
let index = 0;
|
|
74
75
|
|
|
75
|
-
for (; index !==
|
|
76
|
+
for (; index !== expressionsLength; ++index) {
|
|
76
77
|
let expression = expressions[index];
|
|
77
78
|
let literal = literals[index];
|
|
78
79
|
let string;
|
|
@@ -162,9 +163,10 @@ const htmlGenerator = function* ({ raw: literals }, ...expressions) {
|
|
|
162
163
|
* @yields {string} The HTML strings.
|
|
163
164
|
*/
|
|
164
165
|
const htmlAsyncGenerator = async function* ({ raw: literals }, ...expressions) {
|
|
166
|
+
const expressionsLength = expressions.length;
|
|
165
167
|
let index = 0;
|
|
166
168
|
|
|
167
|
-
for (; index !==
|
|
169
|
+
for (; index !== expressionsLength; ++index) {
|
|
168
170
|
let expression = await expressions[index];
|
|
169
171
|
let literal = literals[index];
|
|
170
172
|
let string;
|