Skip to content

Instantly share code, notes, and snippets.

@buildmotion
Created August 28, 2021 20:02
Show Gist options
  • Save buildmotion/7a5621e66e94bbe50ee70a63349b74d3 to your computer and use it in GitHub Desktop.
Save buildmotion/7a5621e66e94bbe50ee70a63349b74d3 to your computer and use it in GitHub Desktop.
export class IsTrue extends SimpleRule {
target: boolean;
constructor(name: string, message: string, target: boolean, isDisplayable: boolean = true) {
super(name, message, isDisplayable);
this.target = target;
}
render() {
this.isValid = true;
if (this.target === false) {//if(not true)-->false;
this.isValid = false;
}
return new RuleResult(this, this.target);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment