( loadedFiles: LoadedFiles | null, sourceId: string )
| 23 | |
| 24 | /** Find a splat source by id, path, or downloaded file name. */ |
| 25 | export function findSplatSourceById( |
| 26 | loadedFiles: LoadedFiles | null, |
| 27 | sourceId: string |
| 28 | ): SplatFileSource | undefined { |
| 29 | const target = normalizeSplatSourceId(sourceId); |
| 30 | return loadedFiles?.splatFileSources?.find((source) => |
| 31 | [source.id, source.path, source.file?.name].some( |
| 32 | (id) => id !== undefined && normalizeSplatSourceId(id) === target |
| 33 | ) |
| 34 | ); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Make `sourceId` the active splat, attaching its freshly-fetched `file`, and |
no test coverage detected