-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Searchable transform interface to abstract class
- Loading branch information
Showing
4 changed files
with
17 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
import Package from './Package'; | ||
|
||
export default interface Searchable { | ||
matches(other: Searchable, packages: Package[]): boolean; | ||
getSearchItemText(): string[]; | ||
matchesPattern(pattern: RegExp): boolean; | ||
export default abstract class Searchable { | ||
public abstract matches(other: Searchable, packages: Package[]): boolean; | ||
|
||
public abstract getSearchItemText(): string[]; | ||
|
||
public matchesPattern(pattern: RegExp): boolean { | ||
return this.getSearchItemText().some((text) => { | ||
console.log(text, pattern); | ||
return text.match(pattern) !== null; | ||
}); | ||
} | ||
} |