(argumentName: string, rawValue: string)
| 61 | } |
| 62 | |
| 63 | export function optionalSecurity(argumentName: string, rawValue: string): "loose" | "strict" | undefined { |
| 64 | if (rawValue.length === 0) { |
| 65 | return undefined; |
| 66 | } |
| 67 | |
| 68 | const cleanValue = rawValue.toLowerCase(); |
| 69 | if (cleanValue === "loose") { |
| 70 | return "loose"; |
| 71 | } |
| 72 | if (cleanValue === "strict") { |
| 73 | return "strict"; |
| 74 | } |
| 75 | |
| 76 | throw new Error(`${argumentName}: invalid parameter - you provided "${rawValue}". Try "loose" or "strict" instead.`); |
| 77 | } |
| 78 | |
| 79 | export function optionalInt(argumentName: string, rawValue: string): number | undefined { |
| 80 | if (rawValue.length === 0) { |
no outgoing calls
no test coverage detected