Skip to content

Commit

Permalink
MatchPattern validator
Browse files Browse the repository at this point in the history
  • Loading branch information
beczkowb committed Feb 23, 2017
1 parent 607166a commit 986f7fb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions openchat/app/utils/text-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,12 @@ export function MinLength(minLength) {
return value.length >= this.minLength;
};
}

export function MatchPattern(pattern) {
this.validatorName = 'matchPattern';
this.pattern = pattern;

this.isValid = function(value) {
return value.match(this.pattern);
}
}

0 comments on commit 986f7fb

Please sign in to comment.