From db746981e04897217af4d7ae64763ed34f9bbbe7 Mon Sep 17 00:00:00 2001 From: Andrii Rodionov Date: Tue, 10 Dec 2024 12:31:59 +0100 Subject: [PATCH] simplified if-else --- openrewrite/src/javascript/parser.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/openrewrite/src/javascript/parser.ts b/openrewrite/src/javascript/parser.ts index 4513f443..61bf41a4 100644 --- a/openrewrite/src/javascript/parser.ts +++ b/openrewrite/src/javascript/parser.ts @@ -1441,19 +1441,11 @@ export class JavaScriptParserVisitor { visitMappedType(node: ts.MappedTypeNode) { function hasPrefixToken(readonlyToken?: ts.ReadonlyKeyword | ts.PlusToken | ts.MinusToken): boolean { - if (readonlyToken && (readonlyToken.kind == ts.SyntaxKind.PlusToken || readonlyToken.kind == ts.SyntaxKind.MinusToken)) { - return true; - } else { - return false; - } + return !!(readonlyToken && (readonlyToken.kind == ts.SyntaxKind.PlusToken || readonlyToken.kind == ts.SyntaxKind.MinusToken)); } function hasSuffixToken(questionToken?: ts.QuestionToken | ts.PlusToken | ts.MinusToken): boolean { - if (questionToken && (questionToken.kind == ts.SyntaxKind.PlusToken || questionToken.kind == ts.SyntaxKind.MinusToken)) { - return true; - } else { - return false; - } + return !!(questionToken && (questionToken.kind == ts.SyntaxKind.PlusToken || questionToken.kind == ts.SyntaxKind.MinusToken)); } return new JS.MappedType(