diff options
Diffstat (limited to 'source/libs/utils.ts')
-rw-r--r-- | source/libs/utils.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/libs/utils.ts b/source/libs/utils.ts index 421d9f66..d304815e 100644 --- a/source/libs/utils.ts +++ b/source/libs/utils.ts @@ -67,3 +67,13 @@ export const flatZip = (table, limit = Infinity) => { return zipped; }; + +export function getOP(): string { + if (isPR()) { + const titleRegex = /^(.+) by (\S+) ยท Pull Request #(\d+)/; + const match = titleRegex.exec(document.title); + return match && match[2]; + } + + return select('.timeline-comment-header-text .author').textContent; +} |