diff options
author | 2019-04-21 01:48:07 -0400 | |
---|---|---|
committer | 2019-04-21 13:48:07 +0800 | |
commit | 9cdb7b377fef47e621a0a0cf5c1df321f1060605 (patch) | |
tree | c4c7eea04da66d38ebbf0b8509e4cd2a17c34023 /source/features/embed-gist-inline.tsx | |
parent | dea7e47bcf61640f4dee9e195fed0ad1ae938781 (diff) | |
download | refined-github-9cdb7b377fef47e621a0a0cf5c1df321f1060605.tar.gz refined-github-9cdb7b377fef47e621a0a0cf5c1df321f1060605.tar.zst refined-github-9cdb7b377fef47e621a0a0cf5c1df321f1060605.zip |
Meta: Add explicit return types on all functions (#1943)
Co-authored-by: Federico Brigante <github@bfred.it>
Diffstat (limited to 'source/features/embed-gist-inline.tsx')
-rw-r--r-- | source/features/embed-gist-inline.tsx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/features/embed-gist-inline.tsx b/source/features/embed-gist-inline.tsx index 8e5ea3ad..48a78f01 100644 --- a/source/features/embed-gist-inline.tsx +++ b/source/features/embed-gist-inline.tsx @@ -3,16 +3,16 @@ import domify from 'doma'; import select from 'select-dom'; import features from '../libs/features'; -const isGist = (link: HTMLAnchorElement) => +const isGist = (link: HTMLAnchorElement): boolean => !link.pathname.includes('.') && // Exclude links to embed files ( link.hostname.startsWith('gist.') || link.pathname.startsWith('gist/') ); -const isOnlyChild = (link: HTMLAnchorElement) => link.textContent!.trim() === link.parentNode!.textContent!.trim(); +const isOnlyChild = (link: HTMLAnchorElement): boolean => link.textContent!.trim() === link.parentNode!.textContent!.trim(); -async function embedGist(link: HTMLAnchorElement) { +async function embedGist(link: HTMLAnchorElement): Promise<void> { const info = <em> (loading)</em>; link.after(info); @@ -42,7 +42,7 @@ async function embedGist(link: HTMLAnchorElement) { } } -function init() { +function init(): void { select.all<HTMLAnchorElement>('.js-comment-body p a:only-child') .filter(item => isGist(item) && isOnlyChild(item)) .forEach(embedGist); |