(key: string)
| 98 | } |
| 99 | |
| 100 | export function optionalStringRecord(key: string): ParamCheck { |
| 101 | return (record) => { |
| 102 | const value = record[key] |
| 103 | if (value === undefined) return null |
| 104 | if (typeof value !== "object" || value === null || Array.isArray(value)) return paramsError(`$.${key}`, `${key} must be an object`) |
| 105 | for (const [entryKey, entryValue] of Object.entries(value)) { |
| 106 | if (typeof entryValue !== "string") return paramsError(`$.${key}.${entryKey}`, `${key} values must be strings`) |
| 107 | } |
| 108 | return null |
| 109 | } |
| 110 | } |
no test coverage detected