diff --git a/client/src/util.ts b/client/src/util.ts index 6c6ff70..59b0c60 100644 --- a/client/src/util.ts +++ b/client/src/util.ts @@ -15,5 +15,10 @@ export function isNullish(value: any) { return (value === null || value === undefined); } +export function variantOf(enumValue: any) { + if (typeof enumValue === 'string') return enumValue; + else return Object.entries(enumValue)[0][0]; +} + export type Index = string | number | symbol; -export type MaybeIndex = Index | null; \ No newline at end of file +export type MaybeIndex = Index | null;