From f0d619850ec67afb5ac421c0dbdae85bb5d03176 Mon Sep 17 00:00:00 2001 From: suzhou Date: Thu, 23 Mar 2023 10:07:55 +0800 Subject: [PATCH] feat: optimize code logic Signed-off-by: suzhou --- src/core/public/doc_links/doc_links_service.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/core/public/doc_links/doc_links_service.ts b/src/core/public/doc_links/doc_links_service.ts index 119202816fea..1d621550e4be 100644 --- a/src/core/public/doc_links/doc_links_service.ts +++ b/src/core/public/doc_links/doc_links_service.ts @@ -53,12 +53,8 @@ export class DocLinksService { } else { const validDocPathsPattern = /^\d+\.\d+$/; const parsedBuildVersion = parse(buildVersion); - if (validDocPathsPattern.test(pkgBranch)) { - branch = pkgBranch; - } else if (parsedBuildVersion) { + if (!validDocPathsPattern.test(pkgBranch) && parsedBuildVersion) { branch = `${parsedBuildVersion.major}.${parsedBuildVersion.minor}`; - } else { - branch = pkgBranch; } } const DOC_LINK_VERSION = branch;