(folderName: string)
| 59 | * Returns null when the trailing 36 chars do not match a UUID-v4-shaped string. |
| 60 | */ |
| 61 | export function parseBookFolderName(folderName: string): string | null { |
| 62 | if (folderName.length < 37) return null; |
| 63 | const candidateId = folderName.slice(-36); |
| 64 | if (!UUID_RE.test(candidateId)) return null; |
| 65 | if (folderName[folderName.length - 37] !== "-") return null; |
| 66 | return candidateId; |
| 67 | } |
| 68 | |
| 69 | /** Heuristic: file is a cover if its extension is a known image format. */ |
| 70 | export function isCoverFileName(fileName: string): boolean { |
no test coverage detected