From f31caa5baad20553cac0330ae9ff279b8f88f340 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 14 Jan 2023 17:38:24 +0530 Subject: feat: adds test cases for do and seq + fixes behavior with empty results --- src/util.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/util.ts') diff --git a/src/util.ts b/src/util.ts index a486294..b7d4efe 100644 --- a/src/util.ts +++ b/src/util.ts @@ -7,9 +7,10 @@ export const match = ( ) => (k && pattern[k] ? pattern[k]() : pattern._()) export const evalList = async (ctx: Ctx, effectTyps: Type[]) => { - const effectResults: string[] = [] + const effectResults: (string | undefined)[] = [] for (const item of effectTyps ?? []) { - effectResults.push(...(await ctx.evaluateType(ctx, item))) + const [resultKey] = await ctx.evaluateType(ctx, item) + effectResults.push(resultKey ? resultKey : undefined) } return effectResults } @@ -69,8 +70,6 @@ export const applyFunc = ( return undefined })() - // TODO: Cleanup unwanted result node values - if (!resultType) { throw new Error('Couldnt get result for function application') } -- cgit v1.3.1