fixed tests

This commit is contained in:
alecmerdler 2017-02-17 13:40:05 -08:00 committed by Joseph Schorr
parent c60ce4a696
commit 389a4cb1c4
3 changed files with 33 additions and 3 deletions

View file

@ -48,7 +48,7 @@ export class RegexMatchViewComponent implements ng.IComponentController {
}
public filterMatches(regexstr: string, items: any[], shouldMatch: boolean): any[] {
public filterMatches(regexstr: string, items: ({value: string})[], shouldMatch: boolean): ({value: string})[] | null {
regexstr = regexstr || '.+';
try {
@ -58,8 +58,8 @@ export class RegexMatchViewComponent implements ng.IComponentController {
}
return items.filter(function(item) {
var value = item['value'];
var m = value.match(regex);
var value: string = item.value;
var m: RegExpMatchArray = value.match(regex);
var matches: boolean = !!(m && m[0].length == value.length);
return matches == shouldMatch;
});