(field: string, value: number | undefined, max: number)
| 959 | } |
| 960 | |
| 961 | const checkNumber = (field: string, value: number | undefined, max: number): number => { |
| 962 | const n = value ?? 0 |
| 963 | if (!Number.isSafeInteger(n) || n < 0 || n > max) { |
| 964 | throw invalidHeader(`invalid ${field} ${n}`) |
| 965 | } |
| 966 | return n |
| 967 | } |
| 968 | |
| 969 | const checkNoNul = (field: string, value: string): string => { |
| 970 | if (value.includes("\0")) { |
no test coverage detected