Skip to content

Commit cf7ea99

Browse files
authored
Add isArchivedRepo (#122)
1 parent f236016 commit cf7ea99

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import reservedNames from 'github-reserved-names/reserved-names.json';
22
import collect from './collector.js';
33

4-
const exists = (selector: string) => Boolean(document.querySelector(selector));
4+
const $ = (selector: string) => document.querySelector(selector);
5+
const exists = (selector: string) => Boolean($(selector));
56

67
const combinedTestOnly = 'combinedTestOnly'; // To be used only to skip tests of combined functions, i.e. isPageA() || isPageB()
78

@@ -349,6 +350,8 @@ export const isEmptyRepoRoot = (): boolean => isRepoHome() && !exists('link[rel=
349350

350351
export const isEmptyRepo = (): boolean => exists('[aria-label="Cannot fork because repository is empty."]');
351352

353+
export const isArchivedRepo = (): boolean => Boolean(isRepo() && $('#repository-container-header .Label')!.textContent!.endsWith('archive'));
354+
352355
export const isBlank = (): boolean => exists('main .blankslate');
353356

354357
export const isRepoTaxonomyConversationList = (url: URL | HTMLAnchorElement | Location = location): boolean => /^labels\/.+|^milestones\/\d+(?!\/edit)/.test(getRepo(url)?.path!);

0 commit comments

Comments
 (0)