(filepath: string)
| 74 | * @returns The prefix string (e.g., '2014-') or an empty string. |
| 75 | */ |
| 76 | export function getCollectionPrefix(filepath: string): string { |
| 77 | const parts = filepath.split('/'); |
| 78 | const yearIdx = parts.findIndex((p) => YEAR_DIR_PATTERN.test(p)); |
| 79 | return yearIdx >= 0 ? parts[yearIdx] + '-' : ''; |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Extracts the BCP 47 locale code from a locale-nested filepath. |
no outgoing calls
no test coverage detected