github-url-detection 10.1.0 → 10.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -96,6 +96,7 @@ export declare const isRepoFile404: (url?: URL | HTMLAnchorElement | Location) =
96
96
  export declare const isRepoForksList: (url?: URL | HTMLAnchorElement | Location) => boolean;
97
97
  export declare const isRepoNetworkGraph: (url?: URL | HTMLAnchorElement | Location) => boolean;
98
98
  export declare const isForkedRepo: () => boolean;
99
+ export declare const isFork: (url?: URL | HTMLAnchorElement | Location) => boolean;
99
100
  export declare const isSingleGist: (url?: URL | HTMLAnchorElement | Location) => boolean;
100
101
  export declare const isGistRevision: (url?: URL | HTMLAnchorElement | Location) => boolean;
101
102
  export declare const isTrending: (url?: URL | HTMLAnchorElement | Location) => boolean;
@@ -33,7 +33,7 @@ var isOrganizationRepo = () => exists('.AppHeader-context-full [data-hovercard-t
33
33
  var isTeamDiscussion = (url = location) => Boolean(getOrg(url)?.path.startsWith("teams"));
34
34
  var isOwnUserProfile = () => getCleanPathname() === getLoggedInUser();
35
35
  var isOwnOrganizationProfile = () => isOrganizationProfile() && !exists('[href*="contact/report-abuse?report="]');
36
- var isProject = (url = location) => /^projects\/\d+/.test(getRepo(url)?.path);
36
+ var isProject = (url = location) => /^projects\/\d+/.test(getRepo(url)?.path ?? getOrg(url)?.path);
37
37
  var isProjects = (url = location) => getRepo(url)?.path === "projects";
38
38
  var isDiscussion = (url = location) => /^discussions\/\d+/.test(getRepo(url)?.path ?? getOrg(url)?.path);
39
39
  var isNewDiscussion = (url = location) => getRepo(url)?.path === "discussions/new" || getOrg(url)?.path === "discussions/new";
@@ -149,6 +149,7 @@ var isRepoFile404 = (url = location) => (isSingleFile(url) || isRepoTree(url)) &
149
149
  var isRepoForksList = (url = location) => getRepo(url)?.path === "network/members";
150
150
  var isRepoNetworkGraph = (url = location) => getRepo(url)?.path === "network";
151
151
  var isForkedRepo = () => exists('meta[name="octolytics-dimension-repository_is_fork"][content="true"]');
152
+ var isFork = (url = location) => getRepo(url)?.path === "fork";
152
153
  var isSingleGist = (url = location) => /^[^/]+\/[\da-f]{20,32}(\/[\da-f]{40})?$/.test(getCleanGistPathname(url));
153
154
  var isGistRevision = (url = location) => /^[^/]+\/[\da-f]{20,32}\/revisions$/.test(getCleanGistPathname(url));
154
155
  var isTrending = (url = location) => url.pathname === "/trending" || url.pathname.startsWith("/trending/");
@@ -267,6 +268,7 @@ export {
267
268
  isEmptyRepoRoot,
268
269
  isEnterprise,
269
270
  isFileFinder,
271
+ isFork,
270
272
  isForkedRepo,
271
273
  isGist,
272
274
  isGistProfile,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "github-url-detection",
3
- "version": "10.1.0",
3
+ "version": "10.2.0",
4
4
  "description": "Which GitHub page are you on? Is it an issue? Is it a list? Perfect for your WebExtension or userscript.",
5
5
  "keywords": [
6
6
  "github",
package/readme.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Which GitHub page are you on? Is it an issue? Is it a list? Perfect for your WebExtension or userscript.
4
4
 
5
- Battle-tested by and extracted from the [Refined GitHub](https://github.com/sindresorhus/refined-github) extension.
5
+ Battle-tested in [Refined GitHub](https://github.com/sindresorhus/refined-github) extension.
6
6
 
7
7
  - Try the live [demo](https://refined-github.github.io/github-url-detection/)
8
8
  - See the code and expected URLs for [every detection](https://github.com/refined-github/github-url-detection/blob/main/index.ts)