user 6 роки тому
батько
коміт
e87b6ac6b6
4 змінених файлів з 18 додано та 2 видалено
  1. 1 0
      lib/contact-item.d.ts
  2. 7 0
      lib/contact-item.js
  3. 1 1
      lib/contact-item.js.map
  4. 9 1
      src/contact-item.ts

+ 1 - 0
lib/contact-item.d.ts

@@ -17,6 +17,7 @@ export declare class ContactItem {
     matchesGroup(group: string): boolean;
     getFirstEmail(): string | undefined;
     getFirstPhone(): string | undefined;
+    getFirstUh(): string | undefined;
     search(search: string): boolean;
     getMatchingAddresses(search: string): ContactAddress[];
     matchesAddressExactly(addressType: string, addressValue: string): boolean;

+ 7 - 0
lib/contact-item.js

@@ -36,6 +36,13 @@ class ContactItem {
         }
         return first.address;
     }
+    getFirstUh() {
+        const first = this.addrs.filter(addr => addr.type === 'uh')[0];
+        if (first == null) {
+            return undefined;
+        }
+        return first.address;
+    }
     search(search) {
         if (this.name.toLowerCase().indexOf(search.toLowerCase().trim()) >= 0) {
             return true;

Різницю між файлами не показано, бо вона завелика
+ 1 - 1
lib/contact-item.js.map


+ 9 - 1
src/contact-item.ts

@@ -53,7 +53,15 @@ export class ContactItem {
       return undefined;
     }
     return first.address;
-}
+  }
+
+  public getFirstUh(): string | undefined {
+    const first = this.addrs.filter(addr => addr.type === 'uh')[0];
+    if (first == null) {
+      return undefined;
+    }
+    return first.address;
+  }
 
   public search(search: string): boolean {
     if (this.name.toLowerCase().indexOf(search.toLowerCase().trim()) >= 0) {