Skip to content

Commit

Permalink
Exclude gists from isNewRepo (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
tigattack authored Jan 15, 2025
1 parent a359e5b commit 278a6d2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export const isGist = (url: URL | HTMLAnchorElement | Location = location): bool
TEST: addTests('isGist', [
'https://gist.github.com',
'http://gist.github.com',
'https://gist.github.com/new',
'https://gist.github.com/fregante/2205329b71218fa2c1d3',
'https://gist.github.com/fregante/2205329b71218fa2c1d3/d1ebf7d9cfaba4d4596d2ea9174e202479a5f9ad',
'https://gist.github.com/sindresorhus/0ea3c2845718a0a0f0beb579ff14f064',
Expand Down Expand Up @@ -756,7 +757,7 @@ export const canUserAdminRepo = (): boolean => isRepo() && exists('.reponav-item
/** @deprecated Use `canUserAdminRepo` */
export const canUserEditRepo = canUserAdminRepo;

export const isNewRepo = (url: URL | HTMLAnchorElement | Location = location): boolean => url.pathname === '/new' || /^organizations\/[^/]+\/repositories\/new$/.test(getCleanPathname(url));
export const isNewRepo = (url: URL | HTMLAnchorElement | Location = location): boolean => !isGist(url) && (url.pathname === '/new' || /^organizations\/[^/]+\/repositories\/new$/.test(getCleanPathname(url)));
TEST: addTests('isNewRepo', [
'https://github.com/new',
'https://github.com/organizations/npmhub/repositories/new',
Expand Down

0 comments on commit 278a6d2

Please sign in to comment.