bug: dont add duplicate tags

This commit is contained in:
2023-04-17 10:14:25 +01:00
parent 445fedcb43
commit c294f5f0bd
3 changed files with 24 additions and 8 deletions

View File

@ -30,7 +30,9 @@ export class EventBuilder {
return this;
}
tag(t: Array<string>) {
tag(t: Array<string>): EventBuilder {
const duplicate = this.#tags.some(a => a.length === t.length && a.every((b, i) => b !== a[i]));
if (duplicate) return this;
this.#tags.push(t);
return this;
}