瀏覽代碼

fix: conditions RegEx

Ahmad Kholid 2 年之前
父節點
當前提交
8b8d7b8b4c
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/utils/testConditions.js

+ 2 - 1
src/utils/testConditions.js

@@ -26,7 +26,8 @@ const comparisons = {
   enw: (a, b) => a?.endsWith(b) ?? false,
   enw: (a, b) => a?.endsWith(b) ?? false,
   rgx: (a, b) => {
   rgx: (a, b) => {
     const match = b.match(/^\/(.*?)\/([gimy]*)$/);
     const match = b.match(/^\/(.*?)\/([gimy]*)$/);
-    const regex = new RegExp(match[1], match[2]);
+    const regex = match ? new RegExp(match[1], match[2]) : new RegExp(b);
+
     return regex.test(a);
     return regex.test(a);
   },
   },
   itr: (a) => Boolean(isBoolStr(a)),
   itr: (a) => Boolean(isBoolStr(a)),