You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
428 B
TypeScript
17 lines
428 B
TypeScript
export class TagQuery {
|
|
constructor(public tag: string, public negate: boolean) {
|
|
}
|
|
|
|
public static fromString(tag: string): TagQuery {
|
|
if (tag.startsWith("-")) {
|
|
return new TagQuery(tag.replace(/^-/g, ""), true);
|
|
} else {
|
|
return new TagQuery(tag, false);
|
|
}
|
|
}
|
|
|
|
public getNormalizedTag(): string {
|
|
return this.negate ? "-" + this.tag : this.tag;
|
|
}
|
|
}
|