Creates a new validation rule and sets its values.
a comparison operation: "==" ("=", "EQ"), "!= " ("<>", "NE"); "<"/">" ("LT"/"GT"), "<="/">=" ("LE"/"GE"); "LIKE".
a constant value to compare to
Validates a given value against this rule.
a dot notation path to the value.
a schema this rule is called from
a value to be validated.
a list with validation results to add new results.
Generated using TypeDoc
Validation rule that compares value to a constant.
IValidationRule
Example
let schema = new Schema() .withRule(new ValueComparisonRule("EQ", 1)); schema.validate(1); // Result: no errors schema.validate(2); // Result: 2 is not equal to 1