Skip to content

Commit 3a2fddf

Browse files
committed
Drop deprecated getRepoPath and getRepoURL
1 parent 0b89413 commit 3a2fddf

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

index.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -547,32 +547,6 @@ const getUsername = () => document.querySelector('meta[name="user-login"]')!.get
547547
/** Drop leading and trailing slashes */
548548
const getCleanPathname = (url: URL | HTMLAnchorElement | Location = location): string => url.pathname.slice(1, url.pathname.endsWith('/') ? -1 : undefined);
549549

550-
/** Parses a repo's subpage
551-
@example '/user/repo/issues/' -> 'issues'
552-
@example '/user/repo/' -> ''
553-
@example '/settings/token/' -> undefined
554-
@deprecated Use getRepositoryInfo().path
555-
*/
556-
const getRepoPath = (url: URL | HTMLAnchorElement | Location = location): string | undefined => {
557-
if (isRepo(url)) {
558-
return getCleanPathname(url).split('/').slice(2).join('/');
559-
}
560-
561-
return undefined;
562-
};
563-
564-
/** Get the 'user/repo' part from an URL. Tries using the canonical URL to avoid capitalization errors in the `location` URL
565-
@deprecated Use getRepositoryInfo().url
566-
*/
567-
const getRepoURL = (url?: URL | Location): string => {
568-
if (!url) {
569-
const canonical = document.querySelector<HTMLMetaElement>('[property="og:url"]'); // `rel=canonical` doesn't appear on every page
570-
url = canonical ? new URL(canonical.content, location.origin) : location;
571-
}
572-
573-
return url.pathname.slice(1).split('/', 2).join('/');
574-
};
575-
576550
export interface RepositoryInfo {
577551
owner: string;
578552
name: string;
@@ -622,6 +596,4 @@ export const utils = {
622596
getUsername,
623597
getCleanPathname,
624598
getRepositoryInfo: getRepo,
625-
getRepoPath,
626-
getRepoURL,
627599
};

0 commit comments

Comments
 (0)