Skip to content

Commit

Permalink
fix: correctly serialise array parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinEberhardt committed Sep 27, 2022
1 parent 6981649 commit b739596
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions template/serializer.ts.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ export function deserialize(json: any, type: string): any {
}

export function serialize(item: any, type: string): string {
if (type.endsWith("[]")) {
const arrayType = type.substring(0, type.length - 2);
return item
.map((item: any) => serialize(item, arrayType))
.join(",");
}
return typeof item === "object" ? JSON.stringify(item) : item.toString();
}

Expand Down

0 comments on commit b739596

Please sign in to comment.