From 72e070bc38807c551ac2a92d0afd5de2834c72ba Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Thu, 20 Oct 2022 22:41:36 -0400 Subject: [PATCH] fix(striker-ui-api): remove empty functions in buildCondition functions --- striker-ui-api/src/lib/buildCondition.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/striker-ui-api/src/lib/buildCondition.ts b/striker-ui-api/src/lib/buildCondition.ts index 81877444..5e23bc45 100644 --- a/striker-ui-api/src/lib/buildCondition.ts +++ b/striker-ui-api/src/lib/buildCondition.ts @@ -1,3 +1,4 @@ +import call from './call'; import join from './join'; import { sanitizeQS } from './sanitizeQS'; @@ -5,9 +6,11 @@ const buildIDCondition = ( keys: Parameters[0], conditionPrefix: string, { - onFallback = () => '', + onFallback, beforeReturn = (result) => - result ? `${conditionPrefix} IN (${result})` : onFallback(), + result + ? `${conditionPrefix} IN (${result})` + : call(onFallback, { notCallableReturn: '' }), }: Pick & { onFallback?: () => string } = {}, ) => join(keys, { @@ -19,7 +22,7 @@ const buildIDCondition = ( export const buildUnknownIDCondition = ( keys: unknown, conditionPrefix: string, - { onFallback = () => '' }: { onFallback?: () => string }, + { onFallback }: { onFallback?: () => string }, ): { after: string; before: string[] } => { const before = sanitizeQS(keys, { modifierType: 'sql',