New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github-url-detection

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-url-detection - npm Package Compare versions

Comparing version 1.2.3 to 2.0.0

19

cjs/index.d.ts

@@ -11,6 +11,6 @@ export declare const is404: () => boolean;

export declare const isGist: (url?: URL | Location) => boolean;
export declare const isGlobalDiscussionList: (url?: URL | Location) => boolean;
export declare const isGlobalConversationList: (url?: URL | Location) => boolean;
export declare const isGlobalSearchResults: (url?: URL | Location) => boolean;
export declare const isIssue: (url?: URL | Location) => boolean;
export declare const isDiscussionList: (url?: URL | Location) => boolean;
export declare const isConversationList: (url?: URL | Location) => boolean;
export declare const isLabelList: (url?: URL | Location) => boolean;

@@ -29,5 +29,3 @@ export declare const isMilestone: (url?: URL | Location) => boolean;

export declare const isPRConflicts: (url?: URL | Location) => boolean;
/** @deprecated use isPRConflicts instead */
export declare const isConflict: (url?: URL | Location) => boolean;
/** Any `isDiscussionList` can display both issues and PRs, prefer that detection. `isPRList` only exists because this page has PR-specific filters like the "Reviews" dropdown */
/** Any `isConversationList` can display both issues and PRs, prefer that detection. `isPRList` only exists because this page has PR-specific filters like the "Reviews" dropdown */
export declare const isPRList: (url?: URL | Location) => boolean;

@@ -44,11 +42,9 @@ export declare const isPRCommit: (url?: URL | Location) => boolean;

export declare const isRepo: (url?: URL | Location) => boolean;
/** @deprecated use isEmptyRepoRoot instead */
export declare const isEmptyRepo: () => boolean;
export declare const isEmptyRepoRoot: () => boolean;
export declare const isRepoTaxonomyDiscussionList: (url?: URL | Location) => boolean;
export declare const isRepoDiscussionList: (url?: URL | Location) => boolean;
export declare const isRepoTaxonomyConversationList: (url?: URL | Location) => boolean;
export declare const isRepoConversationList: (url?: URL | Location) => boolean;
export declare const isRepoPRList: (url?: URL | Location) => boolean;
export declare const isRepoIssueList: (url?: URL | Location) => boolean;
export declare const isRepoHome: (url?: URL | Location) => boolean;
export declare const isRepoRoot: (url?: URL | Location) => boolean;
export declare const isRepoRoot: (url?: URL | Location | undefined) => boolean;
export declare const isRepoSearch: (url?: URL | Location) => boolean;

@@ -79,4 +75,2 @@ export declare const isRepoSettings: (url?: URL | Location) => boolean;

export declare const canUserEditRepo: () => boolean;
/** @deprecated use canUserEditRepo instead */
export declare const isRepoWithAccess: () => boolean;
export declare const utils: {

@@ -86,2 +80,3 @@ getUsername: () => string;

getRepoPath: (url?: URL | Location) => string | undefined;
getRepoURL: (url?: URL | Location) => string;
};

@@ -23,3 +23,3 @@ "use strict";

const isGlobalDiscussionList = (url = location) => [ "issues", "pulls" ].includes(url.pathname.split("/", 2)[1]);
const isGlobalConversationList = (url = location) => [ "issues", "pulls" ].includes(url.pathname.split("/", 2)[1]);

@@ -38,4 +38,2 @@ const isIssue = (url = location) => /^issues\/\d+/.test(getRepoPath(url)) && "GitHub · Where software is built" !== document.title;

const isConflict = isPRConflicts;
const isPRCommit = (url = location) => /^pull\/\d+\/commits\/[\da-f]{5,40}/.test(getRepoPath(url));

@@ -47,5 +45,5 @@

const isRepoTaxonomyDiscussionList = (url = location) => /^labels\/.+|^milestones\/\d+(?!\/edit)/.test(getRepoPath(url));
const isRepoTaxonomyConversationList = (url = location) => /^labels\/.+|^milestones\/\d+(?!\/edit)/.test(getRepoPath(url));
const isRepoDiscussionList = (url = location) => isRepoPRList(url) || isRepoIssueList(url) || isRepoTaxonomyDiscussionList(url);
const isRepoConversationList = (url = location) => isRepoPRList(url) || isRepoIssueList(url) || isRepoTaxonomyConversationList(url);

@@ -56,3 +54,3 @@ const isRepoPRList = (url = location) => String(getRepoPath(url)).startsWith("pulls");

const isRepoRoot = (url = location) => /^(tree\/[^/]+)?$/.test(getRepoPath(url));
const isRepoRoot = url => /^(tree\/[^/]+)?$/.test(getRepoPath(null != url ? url : location)) || !url && document.title.startsWith(getRepoURL()) && !document.title.endsWith(getRepoURL());

@@ -71,6 +69,2 @@ const isRepoSearch = (url = location) => "search" === url.pathname.slice(1).split("/")[2];

const canUserEditRepo = () => isRepo() && exists('.reponav-item[href$="/settings"]');
const isRepoWithAccess = canUserEditRepo;
const getUsername = () => document.querySelector('meta[name="user-login"]').getAttribute("content");

@@ -84,6 +78,9 @@

const getRepoURL = (url = location) => url.pathname.slice(1).split("/", 2).join("/");
const utils = {
getUsername: getUsername,
getCleanPathname: getCleanPathname,
getRepoPath: getRepoPath
getRepoPath: getRepoPath,
getRepoURL: getRepoURL
};

@@ -93,3 +90,3 @@

exports.canUserEditRepo = canUserEditRepo;
exports.canUserEditRepo = () => isRepo() && exists('.reponav-item[href$="/settings"]');

@@ -120,8 +117,6 @@ exports.hasCode = (url = location) => hasComments(url) || isRepoTree(url) || isSingleFile(url) || isGist(url) || isCompare(url) || isBlame(url);

exports.isConflict = isConflict;
exports.isConversationList = (url = location) => isGlobalConversationList(url) || isRepoConversationList(url);
exports.isDashboard = isDashboard;
exports.isDiscussionList = (url = location) => isGlobalDiscussionList(url) || isRepoDiscussionList(url);
exports.isEditingFile = (url = location) => String(getRepoPath(url)).startsWith("edit");

@@ -131,4 +126,2 @@

exports.isEmptyRepo = () => isRepo() && exists(".blankslate");
exports.isEmptyRepoRoot = () => isRepoRoot() && exists(".blankslate");

@@ -144,3 +137,3 @@

exports.isGlobalDiscussionList = isGlobalDiscussionList;
exports.isGlobalConversationList = isGlobalConversationList;

@@ -197,3 +190,3 @@ exports.isGlobalSearchResults = (url = location) => "/search" === url.pathname && null !== new URLSearchParams(url.search).get("q");

exports.isRepoDiscussionList = isRepoDiscussionList;
exports.isRepoConversationList = isRepoConversationList;

@@ -214,8 +207,6 @@ exports.isRepoHome = (url = location) => "" === getRepoPath(url);

exports.isRepoTaxonomyDiscussionList = isRepoTaxonomyDiscussionList;
exports.isRepoTaxonomyConversationList = isRepoTaxonomyConversationList;
exports.isRepoTree = isRepoTree;
exports.isRepoWithAccess = isRepoWithAccess;
exports.isSingleCommit = isSingleCommit;

@@ -222,0 +213,0 @@

@@ -11,6 +11,6 @@ export declare const is404: () => boolean;

export declare const isGist: (url?: URL | Location) => boolean;
export declare const isGlobalDiscussionList: (url?: URL | Location) => boolean;
export declare const isGlobalConversationList: (url?: URL | Location) => boolean;
export declare const isGlobalSearchResults: (url?: URL | Location) => boolean;
export declare const isIssue: (url?: URL | Location) => boolean;
export declare const isDiscussionList: (url?: URL | Location) => boolean;
export declare const isConversationList: (url?: URL | Location) => boolean;
export declare const isLabelList: (url?: URL | Location) => boolean;

@@ -29,5 +29,3 @@ export declare const isMilestone: (url?: URL | Location) => boolean;

export declare const isPRConflicts: (url?: URL | Location) => boolean;
/** @deprecated use isPRConflicts instead */
export declare const isConflict: (url?: URL | Location) => boolean;
/** Any `isDiscussionList` can display both issues and PRs, prefer that detection. `isPRList` only exists because this page has PR-specific filters like the "Reviews" dropdown */
/** Any `isConversationList` can display both issues and PRs, prefer that detection. `isPRList` only exists because this page has PR-specific filters like the "Reviews" dropdown */
export declare const isPRList: (url?: URL | Location) => boolean;

@@ -44,11 +42,9 @@ export declare const isPRCommit: (url?: URL | Location) => boolean;

export declare const isRepo: (url?: URL | Location) => boolean;
/** @deprecated use isEmptyRepoRoot instead */
export declare const isEmptyRepo: () => boolean;
export declare const isEmptyRepoRoot: () => boolean;
export declare const isRepoTaxonomyDiscussionList: (url?: URL | Location) => boolean;
export declare const isRepoDiscussionList: (url?: URL | Location) => boolean;
export declare const isRepoTaxonomyConversationList: (url?: URL | Location) => boolean;
export declare const isRepoConversationList: (url?: URL | Location) => boolean;
export declare const isRepoPRList: (url?: URL | Location) => boolean;
export declare const isRepoIssueList: (url?: URL | Location) => boolean;
export declare const isRepoHome: (url?: URL | Location) => boolean;
export declare const isRepoRoot: (url?: URL | Location) => boolean;
export declare const isRepoRoot: (url?: URL | Location | undefined) => boolean;
export declare const isRepoSearch: (url?: URL | Location) => boolean;

@@ -79,4 +75,2 @@ export declare const isRepoSettings: (url?: URL | Location) => boolean;

export declare const canUserEditRepo: () => boolean;
/** @deprecated use canUserEditRepo instead */
export declare const isRepoWithAccess: () => boolean;
export declare const utils: {

@@ -86,2 +80,3 @@ getUsername: () => string;

getRepoPath: (url?: URL | Location) => string | undefined;
getRepoURL: (url?: URL | Location) => string;
};

@@ -25,3 +25,3 @@ var reservedNames = [ "400", "401", "402", "403", "404", "405", "406", "407", "408", "409", "410", "411", "412", "413", "414", "415", "416", "417", "418", "419", "420", "421", "422", "423", "424", "425", "426", "427", "428", "429", "430", "431", "500", "501", "502", "503", "504", "505", "506", "507", "508", "509", "510", "511", "about", "access", "account", "admin", "anonymous", "any", "api", "apps", "attributes", "auth", "billing", "blob", "blog", "bounty", "branches", "business", "businesses", "c", "cache", "case-studies", "categories", "central", "certification", "changelog", "cla", "cloud", "codereview", "collection", "collections", "comments", "commit", "commits", "community", "companies", "compare", "contact", "contributing", "cookbook", "coupons", "customer", "customers", "dashboard", "dashboards", "design", "develop", "developer", "diff", "discover", "discussions", "docs", "downloads", "downtime", "editor", "editors", "edu", "enterprise", "events", "explore", "featured", "features", "files", "fixtures", "forked", "garage", "ghost", "gist", "gists", "graphs", "guide", "guides", "help", "help-wanted", "home", "hooks", "hosting", "hovercards", "identity", "images", "inbox", "individual", "info", "integration", "interfaces", "introduction", "invalid-email-address", "investors", "issues", "jobs", "join", "journal", "journals", "lab", "labs", "languages", "launch", "layouts", "learn", "legal", "library", "linux", "listings", "lists", "login", "logos", "logout", "mac", "maintenance", "malware", "man", "marketplace", "mention", "mentioned", "mentioning", "mentions", "migrating", "milestones", "mine", "mirrors", "mobile", "navigation", "network", "new", "news", "none", "nonprofit", "nonprofits", "notices", "notifications", "oauth", "offer", "open-source", "organisations", "organizations", "orgs", "pages", "partners", "payments", "personal", "plans", "plugins", "popular", "popularity", "posts", "press", "pricing", "professional", "projects", "pulls", "raw", "readme", "recommendations", "redeem", "releases", "render", "reply", "repositories", "resources", "restore", "revert", "save-net-neutrality", "saved", "scraping", "search", "security", "services", "sessions", "settings", "shareholders", "shop", "showcases", "signin", "signup", "site", "spam", "sponsors", "ssh", "staff", "starred", "stars", "static", "status", "statuses", "storage", "store", "stories", "styleguide", "subscriptions", "suggest", "suggestion", "suggestions", "support", "suspended", "talks", "teach", "teacher", "teachers", "teaching", "teams", "ten", "terms", "timeline", "topic", "topics", "tos", "tour", "train", "training", "translations", "tree", "trending", "updates", "username", "users", "visualization", "w", "watching", "wiki", "windows", "works-with", "www0", "www1", "www2", "www3", "www4", "www5", "www6", "www7", "www8", "www9" ];

const isGlobalDiscussionList = (url = location) => [ "issues", "pulls" ].includes(url.pathname.split("/", 2)[1]);
const isGlobalConversationList = (url = location) => [ "issues", "pulls" ].includes(url.pathname.split("/", 2)[1]);

@@ -32,3 +32,3 @@ const isGlobalSearchResults = (url = location) => "/search" === url.pathname && null !== new URLSearchParams(url.search).get("q");

const isDiscussionList = (url = location) => isGlobalDiscussionList(url) || isRepoDiscussionList(url);
const isConversationList = (url = location) => isGlobalConversationList(url) || isRepoConversationList(url);

@@ -61,4 +61,2 @@ const isLabelList = (url = location) => "labels" === getRepoPath(url);

const isConflict = isPRConflicts;
const isPRList = (url = location) => "/pulls" === url.pathname || "pulls" === getRepoPath(url);

@@ -86,9 +84,7 @@

const isEmptyRepo = () => isRepo() && exists(".blankslate");
const isEmptyRepoRoot = () => isRepoRoot() && exists(".blankslate");
const isRepoTaxonomyDiscussionList = (url = location) => /^labels\/.+|^milestones\/\d+(?!\/edit)/.test(getRepoPath(url));
const isRepoTaxonomyConversationList = (url = location) => /^labels\/.+|^milestones\/\d+(?!\/edit)/.test(getRepoPath(url));
const isRepoDiscussionList = (url = location) => isRepoPRList(url) || isRepoIssueList(url) || isRepoTaxonomyDiscussionList(url);
const isRepoConversationList = (url = location) => isRepoPRList(url) || isRepoIssueList(url) || isRepoTaxonomyConversationList(url);

@@ -101,3 +97,3 @@ const isRepoPRList = (url = location) => String(getRepoPath(url)).startsWith("pulls");

const isRepoRoot = (url = location) => /^(tree\/[^/]+)?$/.test(getRepoPath(url));
const isRepoRoot = url => /^(tree\/[^/]+)?$/.test(getRepoPath(null != url ? url : location)) || !url && document.title.startsWith(getRepoURL()) && !document.title.endsWith(getRepoURL());

@@ -154,4 +150,2 @@ const isRepoSearch = (url = location) => "search" === url.pathname.slice(1).split("/")[2];

const isRepoWithAccess = canUserEditRepo;
const getUsername = () => document.querySelector('meta[name="user-login"]').getAttribute("content");

@@ -165,8 +159,11 @@

const getRepoURL = (url = location) => url.pathname.slice(1).split("/", 2).join("/");
const utils = {
getUsername: getUsername,
getCleanPathname: getCleanPathname,
getRepoPath: getRepoPath
getRepoPath: getRepoPath,
getRepoURL: getRepoURL
};
export { canUserEditOrganization, canUserEditRepo, hasCode, hasComments, hasRichTextEditor, is404, is500, isActionJobRun, isActionPage, isBlame, isBranches, isCommit, isCommitList, isCompare, isConflict, isDashboard, isDiscussionList, isEditingFile, isEditingRelease, isEmptyRepo, isEmptyRepoRoot, isEnterprise, isFileFinder, isForkedRepo, isGist, isGlobalDiscussionList, isGlobalSearchResults, isIssue, isLabelList, isMilestone, isMilestoneList, isNewIssue, isNewRelease, isNotifications, isOrganizationDiscussion, isOrganizationProfile, isOwnOrganizationProfile, isOwnUserProfile, isPR, isPRCommit, isPRCommit404, isPRCommitList, isPRConflicts, isPRConversation, isPRFiles, isPRList, isProject, isQuickPR, isReleasesOrTags, isRepo, isRepoCommitList, isRepoDiscussionList, isRepoHome, isRepoIssueList, isRepoMainSettings, isRepoPRList, isRepoRoot, isRepoSearch, isRepoSettings, isRepoTaxonomyDiscussionList, isRepoTree, isRepoWithAccess, isSingleCommit, isSingleFile, isSingleGist, isSingleTagPage, isTrending, isUserProfile, isUserProfileFollowersTab, isUserProfileFollowingTab, isUserProfileMainTab, isUserProfileRepoTab, isUserProfileStarsTab, utils };
export { canUserEditOrganization, canUserEditRepo, hasCode, hasComments, hasRichTextEditor, is404, is500, isActionJobRun, isActionPage, isBlame, isBranches, isCommit, isCommitList, isCompare, isConversationList, isDashboard, isEditingFile, isEditingRelease, isEmptyRepoRoot, isEnterprise, isFileFinder, isForkedRepo, isGist, isGlobalConversationList, isGlobalSearchResults, isIssue, isLabelList, isMilestone, isMilestoneList, isNewIssue, isNewRelease, isNotifications, isOrganizationDiscussion, isOrganizationProfile, isOwnOrganizationProfile, isOwnUserProfile, isPR, isPRCommit, isPRCommit404, isPRCommitList, isPRConflicts, isPRConversation, isPRFiles, isPRList, isProject, isQuickPR, isReleasesOrTags, isRepo, isRepoCommitList, isRepoConversationList, isRepoHome, isRepoIssueList, isRepoMainSettings, isRepoPRList, isRepoRoot, isRepoSearch, isRepoSettings, isRepoTaxonomyConversationList, isRepoTree, isSingleCommit, isSingleFile, isSingleGist, isSingleTagPage, isTrending, isUserProfile, isUserProfileFollowersTab, isUserProfileFollowingTab, isUserProfileMainTab, isUserProfileRepoTab, isUserProfileStarsTab, utils };
{
"name": "github-url-detection",
"version": "1.2.3",
"version": "2.0.0",
"description": "Which GitHub page are you on? Is it an issue? Is it a list? Perfect for your WebExtension or userscript.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -36,3 +36,3 @@ # <img width="438" align="right" src="https://user-images.githubusercontent.com/1402241/81425503-01b4d800-9158-11ea-9406-484a1ff37968.png"> github-url-detection [![][badge-gzip]][link-bundlephobia]

if (pageDetect.isDiscussionList()) {
if (pageDetect.isConversationList()) {
alert('You’re looking at a issues and PRs list!')

@@ -53,3 +53,3 @@ }

```js
if (pageDetect.isDiscussionList()) {
if (pageDetect.isConversationList()) {
alert('You’re looking at a issues or PRs list!')

@@ -60,3 +60,3 @@ }

```js
if (pageDetect.isDiscussionList(new URL('https://github.com/fregante/github-url-detection/pulls'))) {
if (pageDetect.isConversationList(new URL('https://github.com/fregante/github-url-detection/pulls'))) {
alert('You’re looking at a issues or PRs list!')

@@ -63,0 +63,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc