ghtml 1.7.1 → 1.7.2

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 (3) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/src/html.js +18 -18
package/README.md CHANGED
@@ -78,7 +78,7 @@ const htmlString = html`
78
78
  )}
79
79
  </ul>
80
80
  `
81
- : "<p>No data...</p>"}
81
+ : html`<p>No data...</p>`}
82
82
  </div>
83
83
  `;
84
84
  ```
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.1",
6
+ "version": "1.7.2",
7
7
  "type": "module",
8
8
  "main": "./src/index.js",
9
9
  "exports": {
package/src/html.js CHANGED
@@ -44,10 +44,10 @@ const html = ({ raw: literals }, ...expressions) => {
44
44
  const expression = expressions[index];
45
45
  let literal = literals[index];
46
46
  let string =
47
- expression === undefined || expression === null
48
- ? ""
49
- : typeof expression === "string"
50
- ? expression
47
+ typeof expression === "string"
48
+ ? expression
49
+ : expression === undefined || expression === null
50
+ ? ""
51
51
  : arrayIsArray(expression)
52
52
  ? expression.join("")
53
53
  : `${expression}`;
@@ -78,10 +78,10 @@ const htmlGenerator = function* ({ raw: literals }, ...expressions) {
78
78
  let literal = literals[index];
79
79
  let string;
80
80
 
81
- if (expression === undefined || expression === null) {
82
- string = "";
83
- } else if (typeof expression === "string") {
81
+ if (typeof expression === "string") {
84
82
  string = expression;
83
+ } else if (expression === undefined || expression === null) {
84
+ string = "";
85
85
  } else {
86
86
  if (expression[Symbol.iterator]) {
87
87
  const isRaw =
@@ -96,13 +96,13 @@ const htmlGenerator = function* ({ raw: literals }, ...expressions) {
96
96
  }
97
97
 
98
98
  for (expression of expression) {
99
- if (expression === undefined || expression === null) {
100
- continue;
101
- }
102
-
103
99
  if (typeof expression === "string") {
104
100
  string = expression;
105
101
  } else {
102
+ if (expression === undefined || expression === null) {
103
+ continue;
104
+ }
105
+
106
106
  if (expression[Symbol.iterator]) {
107
107
  for (expression of expression) {
108
108
  if (expression === undefined || expression === null) {
@@ -171,10 +171,10 @@ const htmlAsyncGenerator = async function* ({ raw: literals }, ...expressions) {
171
171
  let literal = literals[index];
172
172
  let string;
173
173
 
174
- if (expression === undefined || expression === null) {
175
- string = "";
176
- } else if (typeof expression === "string") {
174
+ if (typeof expression === "string") {
177
175
  string = expression;
176
+ } else if (expression === undefined || expression === null) {
177
+ string = "";
178
178
  } else {
179
179
  if (expression[Symbol.iterator] || expression[Symbol.asyncIterator]) {
180
180
  const isRaw =
@@ -189,13 +189,13 @@ const htmlAsyncGenerator = async function* ({ raw: literals }, ...expressions) {
189
189
  }
190
190
 
191
191
  for await (expression of expression) {
192
- if (expression === undefined || expression === null) {
193
- continue;
194
- }
195
-
196
192
  if (typeof expression === "string") {
197
193
  string = expression;
198
194
  } else {
195
+ if (expression === undefined || expression === null) {
196
+ continue;
197
+ }
198
+
199
199
  if (
200
200
  expression[Symbol.iterator] ||
201
201
  expression[Symbol.asyncIterator]