diff options
author | Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com> | 2021-08-15 08:35:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-15 14:05:57 +0530 |
commit | ab213dd0a1e51699aae492f8b546e4a311fcb97d (patch) | |
tree | 2dbd59ee85db4899f78f660432190a2df356e8e8 /src/helpers | |
parent | fix: Fixed the 'Changelog' menu item to point to the correct branch (diff) | |
download | ferdium-app-ab213dd0a1e51699aae492f8b546e4a311fcb97d.tar.gz ferdium-app-ab213dd0a1e51699aae492f8b546e4a311fcb97d.tar.zst ferdium-app-ab213dd0a1e51699aae492f8b546e4a311fcb97d.zip |
Initial plumbing and conversion of a simple javascript to typescript (#1790)
* initial conversion of a simple script
* Moved some of the 'gulp' and related npm modules from being runtime dependencies to development dependencies.
Diffstat (limited to 'src/helpers')
-rw-r--r-- | src/helpers/url-helpers.ts (renamed from src/helpers/url-helpers.js) | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/helpers/url-helpers.js b/src/helpers/url-helpers.ts index b0dc9afbb..23e8fab29 100644 --- a/src/helpers/url-helpers.js +++ b/src/helpers/url-helpers.ts | |||
@@ -8,8 +8,8 @@ import { ALLOWED_PROTOCOLS } from '../config'; | |||
8 | 8 | ||
9 | const debug = require('debug')('Ferdi:Helpers:url'); | 9 | const debug = require('debug')('Ferdi:Helpers:url'); |
10 | 10 | ||
11 | export function isValidExternalURL(url) { | 11 | export function isValidExternalURL(url: string) { |
12 | let parsedUrl; | 12 | let parsedUrl: URL; |
13 | try { | 13 | try { |
14 | parsedUrl = new URL(url); | 14 | parsedUrl = new URL(url); |
15 | } catch (_) { | 15 | } catch (_) { |
@@ -23,13 +23,13 @@ export function isValidExternalURL(url) { | |||
23 | return isAllowed; | 23 | return isAllowed; |
24 | } | 24 | } |
25 | 25 | ||
26 | export async function openPath(folderName) { | 26 | export async function openPath(folderName: string) { |
27 | ensureDirSync(folderName); | 27 | ensureDirSync(folderName); |
28 | shell.openPath(folderName); | 28 | shell.openPath(folderName); |
29 | } | 29 | } |
30 | 30 | ||
31 | // TODO: Need to verify and fix/remove the skipping logic. Ideally, we should never skip this check | 31 | // TODO: Need to verify and fix/remove the skipping logic. Ideally, we should never skip this check |
32 | export function openExternalUrl(url, skipValidityCheck = false) { | 32 | export function openExternalUrl(url: string, skipValidityCheck: boolean = false) { |
33 | if (skipValidityCheck || isValidExternalURL(url)) { | 33 | if (skipValidityCheck || isValidExternalURL(url)) { |
34 | shell.openExternal(url); | 34 | shell.openExternal(url); |
35 | } | 35 | } |