浏览代码

refactor regex

Carsten Porth 6 年之前
父节点
当前提交
668f3eb7dc
共有 1 个文件被更改,包括 2 次插入4 次删除
  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 {
   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 {
   private isTweetId(word: string): boolean {
-    const hits = word.match(/tweet:\/\/[0-9]+/);
-    return hits != null;
+    return /tweet:\/\/[0-9]+/.test(word);
   }
   }
 
 
   public async generateRsaKeys() {
   public async generateRsaKeys() {