File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed
MADE.Data.Validation/src/validators Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 1+ import { IValidator } from "./IValidator" ;
2+
3+ export class ContainsValidator implements IValidator {
4+ key : string ;
5+ isInvalid : boolean ;
6+ isDirty : boolean ;
7+ feedbackMessage : string ;
8+ options : any [ ] ;
9+
10+ constructor ( options : any [ ] ) {
11+ this . key = "BetweenValidator" ;
12+ this . isInvalid = false ;
13+ this . isDirty = false ;
14+ this . feedbackMessage = `The value is not a valid option.` ;
15+ this . options = options ;
16+ }
17+
18+ validate ( value : any ) : void {
19+ this . isInvalid = this . options . indexOf ( value ) === - 1 ;
20+ this . isDirty = true ;
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ import { ValidatorArray } from "./ValidatorArray" ;
2+
3+ export interface IValidatorMap {
4+ [ key : string ] : ValidatorArray ;
5+ }
Original file line number Diff line number Diff line change @@ -4,11 +4,13 @@ export * from './RegexValidator';
44export * from './AlphaNumericValidator' ;
55export * from './AlphaValidator' ;
66export * from './BetweenValidator' ;
7+ export * from './ContainsValidator' ;
78export * from './EmailValidator' ;
89export * from './IpAddressValidator' ;
910export * from './MaxLengthValidator' ;
1011export * from './MaxValueValidator' ;
1112export * from './MinLengthValidator' ;
1213export * from './MinValueValidator' ;
1314export * from './RequiredValidator' ;
14- export * from './ValidatorArray' ;
15+ export * from './ValidatorArray' ;
16+ export * from './IValidatorMap' ;
You can’t perform that action at this time.
0 commit comments