"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class ContactItem { constructor(props) { this.data = props; this.hash = props.hash; this.id = props.id; this.addrs = props.addrs || []; this.groups = props.groups || []; this.notes = props.notes || ''; } matchesAddressOrName(search) { if (this.addrs.filter(x => x.indexOf(search.trim()) >= 0).length > 0) { return true; } return false; } matchesGroup(group) { if (this.groups.filter(x => x === group.trim())[0].length > 0) { return true; } return false; } getFirstEmail() { const prefixed = this.addrs.filter(x => x.startsWith('email:'))[0]; if (prefixed == null) { return undefined; } return prefixed.substring(6); } getMatchingAddresses(search) { return this.addrs.filter(x => x.indexOf(search) >= 0); } getData() { return { addrs: this.addrs, groups: this.groups, hash: this.hash, id: this.id, notes: this.notes }; } } exports.ContactItem = ContactItem; //# sourceMappingURL=contact-item.js.map