( raw: unknown, allowed: readonly T[], errorPrefix: string, defaultValue: T | undefined, )
| 848 | } |
| 849 | // fallow-ignore-next-line complexity |
| 850 | function parseEnum<T extends string>( |
| 851 | raw: unknown, |
| 852 | allowed: readonly T[], |
| 853 | errorPrefix: string, |
| 854 | defaultValue: T | undefined, |
| 855 | ): T | undefined { |
| 856 | if (raw === undefined || raw === null || raw === "") return defaultValue; |
| 857 | const s = String(raw); |
| 858 | if ((allowed as readonly string[]).includes(s)) return s as T; |
| 859 | throw new Error(`${errorPrefix} must be ${allowed.join("|")}; got ${s}`); |
| 860 | } |
| 861 | const FORMATS = ["mp4", "mov", "png-sequence", "webm"] as const; |
| 862 | const CODECS = ["h264", "h265"] as const; |
| 863 | const QUALITIES = ["draft", "standard", "high"] as const; |
no outgoing calls
no test coverage detected