feat(merge): pair a title with a qualifier in front of it
titleExtends caught a source appending words ("Bedazzling Dawnstar Sign-In") but not prepending them, which is the shape Game8's "Battle Pass - …" label took. The same qualifier at the other end now pairs too. The two-word floor holds at both ends, because a one-word base would fuse half of a patch day.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2924605bd4
commit
1f6b8fd1d6
3 files changed
+58
-7
No files matched your search
+12
-5
@@ -169,19 +169,26 @@ function isSameEvent(
|
||||
}
|
||||
|
||||
/**
|
||||
* True when one title is the other with words appended — the shape a source
|
||||
* qualifier actually takes ("Bedazzling Dawnstar" → "… Sign-In").
|
||||
* True when one title is the other with words added at either end — the shape
|
||||
* a source qualifier actually takes. Appended: "Bedazzling Dawnstar" → "…
|
||||
* Sign-In". Prepended: Game8's "Battle Pass - Moontrace" beside Fandom's
|
||||
* "Moontrace", where the other source files the category in a column instead.
|
||||
*
|
||||
* Deliberately a prefix test, not a subset test. Subset matching would also
|
||||
* Deliberately an edge test, not a subset test. Subset matching would also
|
||||
* fuse "Gold Clash" with "Gold Rush Clash Royale", which are different events.
|
||||
* Two words is the floor: a one-word title would swallow half the calendar.
|
||||
* Two words is the floor at both ends: a one-word title would swallow half the
|
||||
* calendar.
|
||||
*/
|
||||
export function titleExtends(a: string, b: string): boolean {
|
||||
const ta = tokenList(a);
|
||||
const tb = tokenList(b);
|
||||
const [small, large] = ta.length <= tb.length ? [ta, tb] : [tb, ta];
|
||||
if (small.length < 2 || small.length === large.length) return false;
|
||||
return small.every((word, i) => large[i] === word);
|
||||
const offset = large.length - small.length;
|
||||
return (
|
||||
small.every((word, i) => large[i] === word) ||
|
||||
small.every((word, i) => large[offset + i] === word)
|
||||
);
|
||||
}
|
||||
|
||||
function findConflict(
|
||||
|
||||
Reference in new issue
Block a user