Skip to content

Commit

Permalink
simplified if-else
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrii Rodionov committed Dec 10, 2024
1 parent 5825f76 commit db74698
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions openrewrite/src/javascript/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit db74698

Please sign in to comment.