( input: string | string[] | Record<string, T> | undefined, defaultConfig: T )
| 280 | defaultConfig?: T |
| 281 | ): Record<string, T>; |
| 282 | export function normalizeNetworkEndpoints<T extends IEndpointConfig = IEndpointConfig>( |
| 283 | input: string | string[] | Record<string, T> | undefined, |
| 284 | defaultConfig: T |
| 285 | ): Record<string, T> | undefined { |
| 286 | if (typeof input === 'string') { |
| 287 | return {[input]: defaultConfig ?? {}}; |
| 288 | } else if (Array.isArray(input)) { |
| 289 | return input.reduce( |
| 290 | (acc, endpoint) => { |
| 291 | acc[endpoint] = defaultConfig ?? {}; |
| 292 | return acc; |
| 293 | }, |
| 294 | {} as Record<string, T> |
| 295 | ); |
| 296 | } |
| 297 | |
| 298 | for (const key in input) { |
| 299 | // Yaml can make this null so we ensure it exists |
| 300 | input[key] = input[key] ?? {}; |
| 301 | } |
| 302 | return input; |
| 303 | } |
| 304 | /* eslint-enable no-redeclare */ |
| 305 | |
| 306 | export function notifyUpdates(pjson: Package, logger: Pino.Logger): void { |
no outgoing calls
no test coverage detected