feat: add not

This commit is contained in:
BluJ
2022-07-15 12:52:50 -06:00
parent 5b21ee08b4
commit 3cac71aa96
2 changed files with 28 additions and 1 deletions

View File

@@ -87,6 +87,10 @@ export function rangeOr(...ranges: (string | Checker)[]): Checker {
return firstCheck;
}
export function notRange(range: string | Checker): Checker {
return rangeOf(range).not();
}
export class EmVar {
static from(range: string | EmVar): EmVar {
@@ -148,4 +152,7 @@ export class Checker {
public or(other: Checker): Checker {
return new Checker((value) => this.check(value) || other.check(value));
}
public not(): Checker {
return new Checker((value) => !this.check(value));
}
}