-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add isCompareWikiPage
#118
Conversation
index.ts
Outdated
@@ -54,6 +54,12 @@ collect.set('isCompare', [ | |||
'https://github.com/sindresorhus/refined-github/compare/test-branch?quick_pull=1', | |||
]); | |||
|
|||
export const isCompareWikiPage = (url: URL | HTMLAnchorElement | Location = location): boolean => isRepoWiki(url) && url.pathname.split('/').at(-2) === '_compare'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call me lazy, this should be using regex. Though as of now Array.at()
should only bite Safari < 15.4, which may be a lot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use a negative index at all? Isn't it safer counting from the start? That's how all URLs here work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, somehow when I discovered the page name can be ommited, I thought there can be infinite level of pages, but in fact it is either zero or one.
You can use |
As described above negative indexing is not mandatory. Slice is fine. The biggest consumer of this package is RGH, which has quite a lot Safari users, so use something that requires the latest version of Safari isn't appealing. This is the reason why I brought it up first. |
I ran the publish workflow after merging this PR but got no response. Now when I check it seems to have delayed ~15 minutes #itsamystery |
I think Actions is/was down. I didn't see the CI on refined-github/refined-github#5748 for a while too |
Despite being called "Compare", this page type is more like a crossover between
isCommit
andisGistRevision
, which meanseasy-toggle-files
can support it when this get merged.