diff --git a/striker-ui/lib/isEmpty.ts b/striker-ui/lib/isEmpty.ts index 248ac067..d4cd34c8 100644 --- a/striker-ui/lib/isEmpty.ts +++ b/striker-ui/lib/isEmpty.ts @@ -1,14 +1,16 @@ type MapToValueIsEmptyFunction = { - [TypeName in keyof MapToType]: (value: MapToType[TypeName]) => boolean; + [TypeName in keyof MapToType]: ( + value: MapToType[TypeName] | undefined, + ) => boolean; }; const MAP_TO_VALUE_IS_EMPTY_FUNCTION: MapToValueIsEmptyFunction = { - number: (value: number) => value === 0, - string: (value: string) => value.trim().length === 0, + number: (value = 0) => value === 0, + string: (value = '') => value.trim().length === 0, }; const isEmpty = ( - values: Array, + values: Array, { not, fn = 'every' }: { not?: boolean; fn?: 'every' | 'some' } = {}, ): boolean => values[fn]((value) => {