From 58ef1c04c782befad00895265ceda2381acddd90 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Wed, 19 Oct 2022 23:25:38 -0400 Subject: [PATCH] fix(striker-ui-api): add JoinFunction type --- striker-ui-api/src/lib/join.ts | 6 +++--- .../src/types/{JoinOptions.d.ts => JoinFunction.d.ts} | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) rename striker-ui-api/src/types/{JoinOptions.d.ts => JoinFunction.d.ts} (58%) diff --git a/striker-ui-api/src/lib/join.ts b/striker-ui-api/src/lib/join.ts index 51e91783..bdf05e75 100644 --- a/striker-ui-api/src/lib/join.ts +++ b/striker-ui-api/src/lib/join.ts @@ -1,13 +1,13 @@ import call from './call'; -const join = ( - elements: string[] | string | undefined, +const join: JoinFunction = ( + elements, { beforeReturn, elementWrapper = '', onEach = (element: string) => element, separator = '', - }: JoinOptions = {}, + } = {}, ) => { const joinSeparator = `${elementWrapper}${separator}${elementWrapper}`; diff --git a/striker-ui-api/src/types/JoinOptions.d.ts b/striker-ui-api/src/types/JoinFunction.d.ts similarity index 58% rename from striker-ui-api/src/types/JoinOptions.d.ts rename to striker-ui-api/src/types/JoinFunction.d.ts index 6a968f5a..9039e103 100644 --- a/striker-ui-api/src/types/JoinOptions.d.ts +++ b/striker-ui-api/src/types/JoinFunction.d.ts @@ -4,3 +4,8 @@ type JoinOptions = { onEach?: (element: string) => string; separator?: string; }; + +type JoinFunction = ( + elements: string[] | string | undefined, + options?: JoinOptions, +) => string | undefined;