Skip to content

Commit

Permalink
SB: Fix to make elses optional
Browse files Browse the repository at this point in the history
  • Loading branch information
00salmon committed Nov 25, 2019
1 parent e8a490a commit 508f5f0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsonata-ui-core",
"version": "1.7.2",
"name": "@samsquatch/jsonata-ui-core",
"version": "1.7.5",
"description": "Core AST and serializers for jsonata-ui",
"source": "src/index.ts",
"main": "dist/index.js",
Expand Down
12 changes: 6 additions & 6 deletions src/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ export default function serializer(node: AST): string {
"}"
);
} else if (node.type === "condition") {
return (
serializer(node.condition) +
" ? " +
serializer(node.then) +
" : " +
serializer(node.else)
return (`${serializer(node.condition)} ? ${
serializer(node.then)}
${node.else ?
`: ${serializer(node.else)}`
: ''
}`
);
} else if (node.type === "value") {
if (node.value === null) return "null";
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export interface ConditionNode extends Node {
type: "condition";
condition: JsonataASTNode;
then: JsonataASTNode;
else: JsonataASTNode;
else?: JsonataASTNode;
}

export interface LambdaNode extends Node {
Expand Down

0 comments on commit 508f5f0

Please sign in to comment.