(key: string)
| 76 | } |
| 77 | |
| 78 | export function optionalPositiveInteger(key: string): ParamCheck { |
| 79 | return (record) => { |
| 80 | const value = record[key] |
| 81 | if (value !== undefined && (typeof value !== "number" || !Number.isInteger(value) || value < 1)) { |
| 82 | return paramsError(`$.${key}`, `${key} must be a positive integer`) |
| 83 | } |
| 84 | return null |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | export function optionalStringArray(key: string): ParamCheck { |
| 89 | return (record) => { |
no test coverage detected