Skip to content

Commit

Permalink
Fix isRepoRoot (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Jul 7, 2020
1 parent 56a88f7 commit 23a3921
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ collect.set('isRepoHome', [
]);

export const isRepoRoot = (url?: URL | Location): boolean =>
/^(tree\/[^/]+)?$/.test(getRepoPath(url ?? location)!) ||
(!url && document.title.startsWith(getRepoURL()) && !document.title.endsWith(getRepoURL())); // #15
/^(tree\/[^/]+)?$/.test(getRepoPath(url ?? location)!) &&
(url ? true : (document.title.startsWith(getRepoURL()) && !document.title.endsWith(getRepoURL()))); // #15
collect.set('isRepoRoot', [
...collect.get('isRepoHome') as string[],
'https://github.com/sindresorhus/refined-github/tree/native-copy-buttons',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@rollup/plugin-typescript": "^4.1.2",
"@sindresorhus/tsconfig": "^0.7.0",
"@types/jsdom": "^16.2.3",
"ava": "^3.8.2",
"ava": "^3.10.0",
"esm": "^3.2.25",
"github-reserved-names": "^1.1.8",
"jsdom": "^16.2.2",
Expand Down

0 comments on commit 23a3921

Please sign in to comment.