| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- "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.names = props.names || [];
- 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,
- names: this.names,
- notes: this.notes
- };
- }
- }
- exports.ContactItem = ContactItem;
- //# sourceMappingURL=contact-item.js.map
|