fix(striker-ui-api): add JoinFunction type

This commit is contained in:
Tsu-ba-me 2022-10-19 23:25:38 -04:00
parent e412d615d1
commit 58ef1c04c7
2 changed files with 8 additions and 3 deletions

View File

@ -1,13 +1,13 @@
import call from './call'; import call from './call';
const join = ( const join: JoinFunction = (
elements: string[] | string | undefined, elements,
{ {
beforeReturn, beforeReturn,
elementWrapper = '', elementWrapper = '',
onEach = (element: string) => element, onEach = (element: string) => element,
separator = '', separator = '',
}: JoinOptions = {}, } = {},
) => { ) => {
const joinSeparator = `${elementWrapper}${separator}${elementWrapper}`; const joinSeparator = `${elementWrapper}${separator}${elementWrapper}`;

View File

@ -4,3 +4,8 @@ type JoinOptions = {
onEach?: (element: string) => string; onEach?: (element: string) => string;
separator?: string; separator?: string;
}; };
type JoinFunction = (
elements: string[] | string | undefined,
options?: JoinOptions,
) => string | undefined;