Added function to parse optional boolean to string

This commit is contained in:
Alejandro Celaya
2022-12-28 23:00:55 +01:00
parent a3bd10bc82
commit 1c39e3402b
2 changed files with 21 additions and 1 deletions

View File

@@ -30,3 +30,7 @@ export const equals = (value: any) => (otherValue: any) => value === otherValue;
export type BooleanString = 'true' | 'false';
export const parseBooleanToString = (value: boolean): BooleanString => (value ? 'true' : 'false');
export const parseOptionalBooleanToString = (value?: boolean): BooleanString | undefined => (
value === undefined ? undefined : parseBooleanToString(value)
);