"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class ContactBook { constructor(items) { this.items = items; } getPrimaryEmailAddress() { return this.getFromEmailAddresses()[0]; } getPrimaryPhoneNumber() { return this.getFromPhoneNumbers()[0]; } getFromPhoneNumbers() { const result = []; for (const item of this.items) { for (const address of item.canSendFromAddrs) { if (address.startsWith('phone:')) { result.push(address); } } } return result; } getFromEmailAddresses() { const result = []; for (const item of this.items) { for (const address of item.canSendFromAddrs) { if (address.startsWith('email:')) { result.push(address); } } } return result; } lookupByAddress(addressType, addressValue) { return this.items.find(item => item.matchesAddressExactly(addressType, addressValue)); } lookupById(id) { return this.items.find(item => item.id === id); } search(search) { return this.items.filter(i => i.search(search)); } } exports.ContactBook = ContactBook; //# sourceMappingURL=contact-book.js.map