spooder 4.2.4 → 4.2.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.
- package/package.json +1 -1
- package/src/api.ts +1 -12
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -131,19 +131,8 @@ export function parse_template(template: string, replacements: Record<string, st
|
|
|
131
131
|
} else {
|
|
132
132
|
const loop_content = template.substring(loop_content_start_index, loop_close_index);
|
|
133
133
|
if (loop_entries !== undefined) {
|
|
134
|
-
// More performat than replaceAll on larger arrays (and equal on tiny arrays).
|
|
135
|
-
const content_parts = loop_content.split('%s');
|
|
136
|
-
const indicies = [] as Array<number>;
|
|
137
|
-
|
|
138
|
-
for (let j = 0; j < content_parts.length; j++)
|
|
139
|
-
if (content_parts[j] === '%s')
|
|
140
|
-
indicies.push(j);
|
|
141
|
-
|
|
142
134
|
for (const loop_entry of loop_entries)
|
|
143
|
-
|
|
144
|
-
content_parts[index] = loop_entry;
|
|
145
|
-
|
|
146
|
-
result += content_parts.join('');
|
|
135
|
+
result += loop_content.replaceAll('%s', loop_entry);
|
|
147
136
|
} else {
|
|
148
137
|
result += '{$' + buffer + '}' + loop_content + '{/for}';
|
|
149
138
|
}
|