@ztimson/utils 0.27.16 → 0.27.18
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/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2318,10 +2318,10 @@ async function renderTemplate(template, data, fetch2) {
|
|
|
2318
2318
|
const nested = matchAll(found[0], /\{\{\s*?\?.+?}}/g).slice(-1)?.[0]?.index;
|
|
2319
2319
|
if (nested != 0)
|
|
2320
2320
|
found = /\{\{\s*?\?\s*?(.+?)\s*?}}([\s\S]*?)(?:\{\{\s*?!\?\s*?}}([\s\S]*?))?\{\{\s*?\/\?\s*?}}/g.exec(content.slice(found.index + nested));
|
|
2321
|
-
content = content.
|
|
2321
|
+
content = content.replace(found[0], (evaluate(found[1], d, false) ? found[2] : found[3]) || "");
|
|
2322
2322
|
}
|
|
2323
2323
|
while (!!(found = /\{\{\s*?<\s*?(.+?)\s*?}}/g.exec(content))) {
|
|
2324
|
-
content = content.
|
|
2324
|
+
content = content.replace(found[0], await renderTemplate(await fetch2(found[1].trim()), data, fetch2));
|
|
2325
2325
|
}
|
|
2326
2326
|
while (!!(found = /\{\{\s*?\*\s*?(.+?)\s+in\s+(.+?)\s*?}}([\s\S]*?)\{\{\s*?\/\*\s*?}}/g.exec(content))) {
|
|
2327
2327
|
const split = found[1].replaceAll(/[()\s]/g, "").split(",");
|
|
@@ -2338,13 +2338,13 @@ async function renderTemplate(template, data, fetch2) {
|
|
|
2338
2338
|
[index]: i
|
|
2339
2339
|
}, fetch2));
|
|
2340
2340
|
}
|
|
2341
|
-
content = content.
|
|
2341
|
+
content = content.replace(found[0], compiled.join("\n"));
|
|
2342
2342
|
}
|
|
2343
2343
|
while (!!(found = /\{\{\s*([^<>\*\?!/}\s][^}]*?)\s*}}/g.exec(content))) {
|
|
2344
|
-
content = content.
|
|
2344
|
+
content = content.replace(found[0], evaluate(found[1].trim(), d) || "");
|
|
2345
2345
|
}
|
|
2346
2346
|
while (!!(found = /\{\{\s*?>\s*?(.+?):(.+?)\s*?}}([\s\S]*?)\{\{\s*?\/>\s*?}}/g.exec(content))) {
|
|
2347
|
-
content = content.replace(found[0], await renderTemplate(await fetch2(found[1].trim), {
|
|
2347
|
+
content = content.replace(found[0], await renderTemplate(await fetch2(found[1].trim()), {
|
|
2348
2348
|
...data,
|
|
2349
2349
|
[found[2].trim()]: found[3]
|
|
2350
2350
|
}, fetch2));
|