Skip to content

Commit e01f3b3

Browse files
committed
o(1) enum conversion
1 parent 8aee608 commit e01f3b3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/interfaces.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ export enum FormatEnum {
148148
CLIENT = 'CLIENT',
149149
PRECOMPUTED = 'PRECOMPUTED',
150150
}
151-
// enums are a little sticky to work with in conjunction with serialization.
151+
152152
export function getFormatFromString(str: string | null): FormatEnum {
153153
// default to SERVER. Should always be set, but the ConfigurationStore allows null.
154-
return Object.values(FormatEnum).find((val) => val === str) ?? FormatEnum.SERVER;
154+
return FormatEnum[str as keyof typeof FormatEnum] ?? FormatEnum.SERVER;
155155
}
156156

157157
export type BasePrecomputedFlag = {

0 commit comments

Comments
 (0)