mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-06-21 10:39:26 +08:00
18 lines
472 B
TypeScript
18 lines
472 B
TypeScript
export enum Action {
|
|
DEPLOY = 'deploy',
|
|
PROMOTE = 'promote',
|
|
REJECT = 'reject'
|
|
}
|
|
|
|
/**
|
|
* Converts a string to the Action enum
|
|
* @param str The action type (case insensitive)
|
|
* @returns The Action enum or undefined if it can't be parsed
|
|
*/
|
|
export const parseAction = (str: string): Action | undefined =>
|
|
Action[
|
|
Object.keys(Action).filter(
|
|
(k) => Action[k].toString().toLowerCase() === str.toLowerCase()
|
|
)[0] as keyof typeof Action
|
|
]
|