-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added email specific option for sendanor/project-sendanor.fi#251
- Loading branch information
Jaakko Heusala
committed
Sep 5, 2024
1 parent
ad68c86
commit 7b6cce5
Showing
2 changed files
with
50 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) 2024. Heusala Group Oy <info@heusalagroup.fi>. All rights reserved. | ||
|
||
import { | ||
explainEnum, | ||
isEnum, | ||
parseEnum, | ||
stringifyEnum, | ||
} from "../../../../types/Enum"; | ||
import { | ||
explainNot, | ||
explainOk, | ||
explainOr, | ||
} from "../../../../types/explain"; | ||
import { isUndefined } from "../../../../types/undefined"; | ||
|
||
export enum EmailOption { | ||
ADMIN_CONFIGURABLE = "ADMIN_CONFIGURABLE", | ||
} | ||
|
||
export function isEmailOption (value: unknown) : value is EmailOption { | ||
return isEnum(EmailOption, value); | ||
} | ||
|
||
export function explainEmailOption (value : unknown) : string { | ||
return explainEnum("EmailOption", EmailOption, isEmailOption, value); | ||
} | ||
|
||
export function stringifyEmailOption (value : EmailOption) : string { | ||
return stringifyEnum(EmailOption, value); | ||
} | ||
|
||
export function parseEmailOption (value: any) : EmailOption | undefined { | ||
return parseEnum(EmailOption, value) as EmailOption | undefined; | ||
} | ||
|
||
export function isEmailOptionOrUndefined (value: unknown): value is EmailOption | undefined { | ||
return isUndefined(value) || isEmailOption(value); | ||
} | ||
|
||
export function explainEmailOptionOrUndefined (value: unknown): string { | ||
return isEmailOptionOrUndefined(value) ? explainOk() : explainNot(explainOr(['EmailOption', 'undefined'])); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters