Refactor episode regex handling for improved clarity and maintainability
Updated the separator handling in the buildEpisodeRegex function to enhance readability. The change replaces the inline conditional for the gap with a dedicated variable, making the code more understandable while maintaining functionality.
This commit is contained in:
@@ -56,7 +56,8 @@ export function buildEpisodeRegex(fileName: string, occurrenceIndex: number): st
|
||||
// к первому сезону, и на «S02E05» оно бы уже не сработало.
|
||||
const anchor = trailingRun(anchorSource, isLetter)
|
||||
|
||||
if (anchor) return `${escapeRegex(anchor)}${gap ? String.raw`[\s._-]*` : ''}${digits}`
|
||||
const separator = gap ? String.raw`[\s._-]*` : ''
|
||||
if (anchor) return `${escapeRegex(anchor)}${separator}${digits}`
|
||||
|
||||
// Слова перед числом нет — цепляемся за последний разделитель («- 05», «(05)»).
|
||||
const punctuation = gap.trim().slice(-1)
|
||||
|
||||
Reference in New Issue
Block a user