github-url-detection 10.1.1 → 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.
- package/distribution/index.d.ts +1 -0
- package/distribution/index.js +2 -0
- package/package.json +1 -1
- package/readme.md +1 -1
package/distribution/index.d.ts
CHANGED
|
@@ -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;
|
package/distribution/index.js
CHANGED
|
@@ -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
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
|
|
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)
|