( list: ReadonlyArray<T>, id: string, )
| 29 | } from './audio-providers' |
| 30 | |
| 31 | function findConfig<T extends { id: string }>( |
| 32 | list: ReadonlyArray<T>, |
| 33 | id: string, |
| 34 | ): T { |
| 35 | const match = list.find((entry) => entry.id === id) |
| 36 | if (!match) { |
| 37 | throw new UnknownProviderError( |
| 38 | id, |
| 39 | list.map((entry) => entry.id), |
| 40 | ) |
| 41 | } |
| 42 | return match |
| 43 | } |
| 44 | |
| 45 | export function buildSpeechAdapter(provider: SpeechProviderId): AnyTTSAdapter { |
| 46 | const config = findConfig(SPEECH_PROVIDERS, provider) |
no outgoing calls
no test coverage detected