mirror of
https://github.com/cupcakearmy/cometa.git
synced 2025-03-12 06:17:29 +00:00
Error catching and perfomance tweaks
This commit is contained in:
parent
b1cdeac3c7
commit
49c917df6b
@ -154,14 +154,21 @@ export const loop: ActionFunction = (html, options, re) => {
|
|||||||
|
|
||||||
html = html.substring(current.found[0].length, next.end.index)
|
html = html.substring(current.found[0].length, next.end.index)
|
||||||
|
|
||||||
|
const content = compileBlock(html, options, re)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
parts: [(data: any) => {
|
parts: [(data: any) => {
|
||||||
let ret = ''
|
const it = getFromObject(data, current.arr)
|
||||||
for (const variable of getFromObject(data, current.arr)) {
|
if (!(Symbol.iterator in Object(it)))
|
||||||
const newData = Object.assign({ [current.variable]: variable }, data)
|
return ''
|
||||||
ret += computeParts(compileBlock(html, options, re).parts, newData)
|
else {
|
||||||
|
let ret = ''
|
||||||
|
for (const variable of it) {
|
||||||
|
const newData = Object.assign({ [current.variable]: variable }, data)
|
||||||
|
ret += computeParts(content.parts, newData)
|
||||||
|
}
|
||||||
|
return ret
|
||||||
}
|
}
|
||||||
return ret
|
|
||||||
}],
|
}],
|
||||||
length: next.end.index + next.end[0].length
|
length: next.end.index + next.end[0].length
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user