diff --git a/src/translator.ts b/src/translator.ts index bd4ce61..e0bbd40 100644 --- a/src/translator.ts +++ b/src/translator.ts @@ -101,6 +101,11 @@ export class JsonTemplateTranslator { code.push(`let ${dest};`); code.push(this.vars.map((elm) => `let ${elm};`).join('')); code.push(exprCode); + code.push(` + if (!Array.isArray(${dest})) { + ${dest} = [${dest}]; + } + `); code.push(`return ${dest};`); return code.join('');