Skip to content

Commit 5b0eee7

Browse files
add isHome & isFeed
1 parent 6f5d835 commit 5b0eee7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ TEST: addTests('isCompareWikiPage', [
6161
'https://github.com/brookhong/Surfingkeys/wiki/Color-Themes/_compare/8ebb46b1a12d16fc1af442b7df0ca13ca3bb34dc...80e51eeabe69b15a3f23880ecc36f800b71e6c6d',
6262
]);
6363

64+
/**
65+
* @deprecated Use `isHome` and/or `isFeed` instead
66+
*/
6467
export const isDashboard = (url: URL | HTMLAnchorElement | Location = location): boolean => !isGist(url) && /^$|^(orgs\/[^/]+\/)?dashboard(-feed)?(\/|$)/.test(getCleanPathname(url));
6568
TEST: addTests('isDashboard', [
6669
'https://github.com///',
@@ -84,6 +87,18 @@ TEST: addTests('isDashboard', [
8487
'https://github.com/dashboard-feed',
8588
]);
8689

90+
export const isHome = (url: URL | HTMLAnchorElement | Location = location): boolean => !isGist(url) && /^$|^dashboard(\/|$)/.test(getCleanPathname(url));
91+
TEST: addTests('isHome', [
92+
'https://github.com',
93+
'https://github.com/dashboard',
94+
]);
95+
96+
export const isFeed = (url: URL | HTMLAnchorElement | Location = location): boolean => !isGist(url) && /^(feed|orgs\/[^/]+\/dashboard)(\/|$)/.test(getCleanPathname(url));
97+
TEST: addTests('isFeed', [
98+
'https://github.com/feed',
99+
'https://github.com/orgs/refined-github/dashboard',
100+
]);
101+
87102
export const isEnterprise = (url: URL | HTMLAnchorElement | Location = location): boolean => url.hostname !== 'github.com' && url.hostname !== 'gist.github.com';
88103
TEST: addTests('isEnterprise', [
89104
'https://github.big-corp.com/',

0 commit comments

Comments
 (0)