Browse Source

refactor regex

Carsten Porth 6 years ago
parent
commit
668f3eb7dc
1 changed files with 2 additions and 4 deletions
  1. 2 4
      app/src/providers/crypto/crypto.ts

+ 2 - 4
app/src/providers/crypto/crypto.ts

@@ -105,13 +105,11 @@ export class CryptoProvider {
   }
 
   private isIpfsLink(word: string): boolean {
-    const hits = word.match(/ipfs:\/\/Qm[a-zA-Z0-9]+/);
-    return hits != null;
+    return /ipfs:\/\/Qm[a-zA-Z0-9]+/.test(word);
   }
 
   private isTweetId(word: string): boolean {
-    const hits = word.match(/tweet:\/\/[0-9]+/);
-    return hits != null;
+    return /tweet:\/\/[0-9]+/.test(word);
   }
 
   public async generateRsaKeys() {