Skip to content

Commit

Permalink
Ensure consisteny response for all types
Browse files Browse the repository at this point in the history
  • Loading branch information
josharsh committed Jul 2, 2024
1 parent 0d09b0b commit d9e3b15
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/translator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
Expand Down

0 comments on commit d9e3b15

Please sign in to comment.