| 123456789101112131415161718192021222324252627282930313233 |
- import { ContactParams } from "./contact-params";
- export class ContactItem {
- public readonly data: ContactParams;
- public readonly id: string;
- public readonly hash: string;
- public readonly addrs: string[];
- public readonly groups: string[];
-
- constructor(props: ContactParams) {
- this.data = props;
- this.hash = props.hash;
- this.id = props.id;
- this.addrs = props.addrs || [];
- this.groups = props.groups || [];
- }
- public matchesAddressOrName(search: string) {
- if (this.addrs.filter(x => x.indexOf(search.trim()) >= 0)[0].length > 0) {
- return true;
- }
- return false;
- }
- public matchesGroup(group: string) {
- if (this.groups.filter(x => x === group.trim())[0].length > 0) {
- return true;
- }
- return false;
- }
- }
|