You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
718 B
25 lines
718 B
4 years ago
|
export class Tag {
|
||
|
triggers: string[] = [];
|
||
|
tagName: string;
|
||
|
filterType: TagFilterType;
|
||
|
|
||
|
constructor(triggers: string[], tagName: string, filterType: TagFilterType) {
|
||
|
let trigger: string; for (trigger of triggers) {
|
||
|
this.triggers.push(
|
||
|
trigger.trim().startsWith("-") ? trigger.trim() : `-${trigger.trim()}`
|
||
|
);
|
||
|
}
|
||
|
|
||
|
this.tagName = tagName;
|
||
|
this.filterType = filterType;
|
||
|
};
|
||
|
|
||
|
public addTrigger(trigger: string): Tag {
|
||
|
this.triggers.push(
|
||
|
trigger.trim().startsWith("-") ? trigger.trim() : `-${trigger.trim()}`
|
||
|
);
|
||
|
return this;
|
||
|
};
|
||
|
}
|
||
|
|
||
|
type TagFilterType = "append" | "toggle" | "listAppend";
|