22// SPDX-License-Identifier: MIT
33
44// getHostName - returns the hostname if possible, otherwise an empty string
5- function getHostName ( url : string | URL ) {
5+ export function getHostName ( url : string | URL ) {
66 let hostname = "" ;
77 try {
88 hostname = new URL ( url ) . hostname ;
99 } catch ( error ) {
10- console . log ( "Invalid URL" ) ;
1110 console . error ( error ) ;
1211 }
1312 return hostname ;
1413}
1514
1615// getPRLink - returns the PR link if possible otherwise an empty string
17- function getPRLink ( gitRepo : string , prID : number ) {
16+ export function getPRLink ( gitRepo : string , prID : number ) {
1817 const forge = getHostName ( gitRepo ) ;
1918 switch ( forge ) {
2019 case "github.com" :
@@ -28,7 +27,7 @@ function getPRLink(gitRepo: string, prID: number) {
2827}
2928
3029// getBranchLink - returns the branch link if possible otherwise an empty string
31- function getBranchLink ( gitRepo : string , branchName : string ) {
30+ export function getBranchLink ( gitRepo : string , branchName : string ) {
3231 const forge = getHostName ( gitRepo ) ;
3332 switch ( forge ) {
3433 case "github.com" :
@@ -42,7 +41,7 @@ function getBranchLink(gitRepo: string, branchName: string) {
4241}
4342
4443// getIssueLink - returns the issue link if possible otherwise an empty string
45- function getIssueLink ( gitRepo : string , issueID : number ) {
44+ export function getIssueLink ( gitRepo : string , issueID : number ) {
4645 const forge = getHostName ( gitRepo ) ;
4746 switch ( forge ) {
4847 case "github.com" :
@@ -56,7 +55,7 @@ function getIssueLink(gitRepo: string, issueID: number) {
5655}
5756
5857// getReleaseLink - returns the link to release if possible otherwise an empty string
59- function getReleaseLink ( gitRepo : string , release : string ) {
58+ export function getReleaseLink ( gitRepo : string , release : string ) {
6059 const forge = getHostName ( gitRepo ) ;
6160 switch ( forge ) {
6261 case "github.com" :
@@ -69,7 +68,7 @@ function getReleaseLink(gitRepo: string, release: string) {
6968}
7069
7170// getCommitLink - returns a link to the commit
72- function getCommitLink ( gitRepo : string , commit_hash : string ) {
71+ export function getCommitLink ( gitRepo : string , commit_hash : string ) {
7372 const forge = getHostName ( gitRepo ) ;
7473 switch ( forge ) {
7574 case "github.com" :
@@ -81,12 +80,3 @@ function getCommitLink(gitRepo: string, commit_hash: string) {
8180 return `${ gitRepo } /-/commit/${ commit_hash } ` ;
8281 }
8382}
84-
85- export {
86- getHostName ,
87- getPRLink ,
88- getBranchLink ,
89- getIssueLink ,
90- getReleaseLink ,
91- getCommitLink ,
92- } ;
0 commit comments