From 7c9fa1cb655bebf175cddce1b6e9551b150ee1c8 Mon Sep 17 00:00:00 2001 From: liangfung Date: Wed, 18 Dec 2024 13:59:32 +0700 Subject: [PATCH] update --- ee/tabby-ui/lib/utils/repository.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 ee/tabby-ui/lib/utils/repository.ts diff --git a/ee/tabby-ui/lib/utils/repository.ts b/ee/tabby-ui/lib/utils/repository.ts new file mode 100644 index 000000000000..dfd582878c4c --- /dev/null +++ b/ee/tabby-ui/lib/utils/repository.ts @@ -0,0 +1,9 @@ +import { go } from 'fuzzysort' + +export const findClosestRepositoryMatch = ( + target: string, + gitUrls: string[] +) => { + const results = go(target.replace(/\.git$/, ''), gitUrls) + return results.length > 0 ? results[0].target : null +}