From 361e769b45dd93b228cc9340fff94d90c2936cbe Mon Sep 17 00:00:00 2001 From: TaYaKi71751 Date: Thu, 1 Aug 2024 05:20:41 +0900 Subject: [PATCH] Fix if statement --- url.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/url.js b/url.js index d2f216f..322c576 100644 --- a/url.js +++ b/url.js @@ -19,7 +19,17 @@ if(document.location.pathname.startsWith('/title')){ let jbv = undefined; document.location.pathname.split('/').forEach((str) => { - if(str.length && (str.match(/^[0-9]+$/)[0] == str)){ + if( + str.length && + (() => { + let result = str.match(/^[0-9]+$/); + if(result == null || !result.length){ + return [undefined]; + } else { + return result; + } + })()[0] == str + ){ jbv = str; } });