From 28d4ee93cfb5e173d013c2761c98240643bef610 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Wed, 3 Apr 2024 19:18:28 +0900 Subject: [PATCH] Refactor blockEndMatcher function to use switch statement --- src/ts/parser.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/ts/parser.ts b/src/ts/parser.ts index bc48b02e..5fc291f3 100644 --- a/src/ts/parser.ts +++ b/src/ts/parser.ts @@ -917,16 +917,20 @@ function blockStartMatcher(p1:string,matcherArg:matcherArg):blockMatch{ } function blockEndMatcher(p1:string,type:blockMatch,matcherArg:matcherArg):string{ - if(type === 'ignore'){ - return '' + switch(type){ + case 'ignore':{ + return '' + } + case 'parse':{ + return p1.trim() + } + case 'parse-pure':{ + return p1 + } + default:{ + return '' + } } - if(type === 'parse'){ - return p1.trim() - } - if(type === 'parse-pure'){ - return p1 - } - return '' } export function risuChatParser(da:string, arg:{