export default function toRepositoryId ( s ) { if ( ! s . includes ( '://' ) && s . includes ( ':' ) ) { const [ host , path ] = s . split ( ':' , 2 ) ; s = `ssh://${ host }/${ path }` ; } s = s . replace ( /\.git$/ , '' ) ; const url = new URL ( s ) ; return `${ url . hostname }${ url . pathname }` ; }