diff options
author | 2019-05-11 06:29:05 +0530 | |
---|---|---|
committer | 2019-05-11 08:59:05 +0800 | |
commit | bcb9ed292c93bf81f3f0188e5de9e6b0106409d8 (patch) | |
tree | ee6b4d3d944b579ba51f669bbb5c551e911568ba /source/libs/utils.ts | |
parent | 123425df7037f6453122930f7e6146b0ae70a4dc (diff) | |
download | refined-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.ts | 5 |
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[]> = {}; |