mirror of
https://github.com/Horizontal42/summarum.git
synced 2026-11-11 02:12:00 +03:00
Merge 13fa559536 into bede889ced
This commit is contained in:
commit
4f87947e38
1 changed files with 6 additions and 1 deletions
|
|
@ -88,7 +88,12 @@ export class Registry {
|
||||||
const list = this.byFirst.get(key);
|
const list = this.byFirst.get(key);
|
||||||
if (list) {
|
if (list) {
|
||||||
// first registration of an identical phrase wins (core vocab is added first)
|
// first registration of an identical phrase wins (core vocab is added first)
|
||||||
if (list.some((e) => e.caseSensitive === caseSensitive && (caseSensitive ? e.lexemes.join(" ") === lexemes.join(" ") : e.lower.join(" ") === entry.lower.join(" ")))) {
|
if (list.some((e) => {
|
||||||
|
if (e.caseSensitive !== caseSensitive || e.lexemes.length !== lexemes.length) return false;
|
||||||
|
const target = caseSensitive ? lexemes : entry.lower;
|
||||||
|
const source = caseSensitive ? e.lexemes : e.lower;
|
||||||
|
return source.every((val, i) => val === target[i]);
|
||||||
|
})) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
list.push(entry);
|
list.push(entry);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue