Function
optionalNumber
(args: Record<string, unknown>, key: string)
Source from the content-addressed store, hash-verified
| 81 | } |
| 82 | |
| 83 | function optionalNumber(args: Record<string, unknown>, key: string): number | undefined { |
| 84 | const value = args[key] |
| 85 | if (value == null) return undefined |
| 86 | if (typeof value !== 'number' || !Number.isFinite(value)) { |
| 87 | throw new Error(`${key} must be a number`) |
| 88 | } |
| 89 | return value |
| 90 | } |
| 91 | |
| 92 | function optionalStringArray(args: Record<string, unknown>, key: string): string[] | undefined { |
| 93 | const value = args[key] |
Tested by
no test coverage detected