Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
kovsu committed Nov 4, 2024
1 parent 02ee907 commit d144e72
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,19 +286,24 @@ TEST: addTests('isQuickPR', [
'https://github.com/sindresorhus/refined-github/compare/test-branch?quick_pull=1',
]);

export const isDraftPR = (): boolean => ($('.State') ?? $('[class^="StateLabel"]'))!.textContent!.trim() === 'Draft';
const prStateSelector = [
'.State',
'[class^="StateLabel"]',
].join(',');

export const isDraftPR = (): boolean => $(prStateSelector)!.textContent!.trim() === 'Draft';
export const isOpenPR = (): boolean => {
const status = ($('.State') ?? $('[class^="StateLabel"]'))!.textContent!.trim();
const status = $(prStateSelector)!.textContent!.trim();
return status === 'Open' || status === 'Draft';
};

export const isMergedPR = (): boolean => {
const status = ($('.State') ?? $('[class^="StateLabel"]'))!.textContent!.trim();
const status = $(prStateSelector)!.textContent!.trim();
return status === 'Merged';
};

export const isClosedPR = (): boolean => {
const status = ($('.State') ?? $('[class^="StateLabel"]'))!.textContent!.trim();
const status = $(prStateSelector)!.textContent!.trim();
return status === 'Closed' || status === 'Merged';
};

Expand Down

0 comments on commit d144e72

Please sign in to comment.