summaryrefslogtreecommitdiff
path: root/source/libs/utils.ts
diff options
context:
space:
mode:
authorGravatar Hardik Modha <hardikmodha22@gmail.com> 2019-05-11 06:29:05 +0530
committerGravatar Federico Brigante <github@bfred.it> 2019-05-11 08:59:05 +0800
commitbcb9ed292c93bf81f3f0188e5de9e6b0106409d8 (patch)
treeee6b4d3d944b579ba51f669bbb5c551e911568ba /source/libs/utils.ts
parent123425df7037f6453122930f7e6146b0ae70a4dc (diff)
downloadrefined-github-bcb9ed292c93bf81f3f0188e5de9e6b0106409d8.tar.gz
refined-github-bcb9ed292c93bf81f3f0188e5de9e6b0106409d8.tar.zst
refined-github-bcb9ed292c93bf81f3f0188e5de9e6b0106409d8.zip
Add `tag-changelog-link` feature (#1998)
Co-authored-by: Federico Brigante <github@bfred.it>
Diffstat (limited to 'source/libs/utils.ts')
-rw-r--r--source/libs/utils.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/libs/utils.ts b/source/libs/utils.ts
index a3dea51a..a7ddf562 100644
--- a/source/libs/utils.ts
+++ b/source/libs/utils.ts
@@ -40,6 +40,11 @@ export const getOwnerAndRepo = (): {
return {ownerName, repoName};
};
+export const parseTag = (tag: string): {version: string; namespace: string} => {
+ const [, namespace = '', version = ''] = tag.match(/(?:(.*)@)?([^@]+)/) || [];
+ return {namespace, version};
+};
+
export const groupBy = (iterable: Iterable<string>, grouper: (item: string) => string): Record<string, string[]> => {
const map: Record<string, string[]> = {};