Function
optionalStringEnum
(key: string, values: readonly string[])
Source from the content-addressed store, hash-verified
| 43 | } |
| 44 | |
| 45 | export function optionalStringEnum(key: string, values: readonly string[]): ParamCheck { |
| 46 | return (record) => { |
| 47 | const value = record[key] |
| 48 | if (value === undefined) return null |
| 49 | if (typeof value !== "string" || !values.includes(value)) return paramsError(`$.${key}`, `${key} must be one of: ${values.join(", ")}`) |
| 50 | return null |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | export function optionalBoolean(key: string): ParamCheck { |
| 55 | return (record) => { |
Tested by
no test coverage detected