(functionPath: string)
| 34 | * sanitizeConsumerName('my_func.ts') // => 'my__func_Dts' |
| 35 | */ |
| 36 | export function sanitizeConsumerName(functionPath: string): string { |
| 37 | let result = ''; |
| 38 | for (const char of functionPath) { |
| 39 | if (char === '_') { |
| 40 | result += '__'; |
| 41 | } else if (char === '/') { |
| 42 | result += '_S'; |
| 43 | } else if (char === '.') { |
| 44 | result += '_D'; |
| 45 | } else if (/[A-Za-z0-9-]/.test(char)) { |
| 46 | result += char; |
| 47 | } else { |
| 48 | result += |
| 49 | '_' + char.charCodeAt(0).toString(16).toUpperCase().padStart(2, '0'); |
| 50 | } |
| 51 | } |
| 52 | return result; |
| 53 | } |
| 54 | |
| 55 | export type LambdaOptions = LambdaOptionsWithFiles | LambdaOptionsWithZipBuffer; |
| 56 |
no test coverage detected