mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 22:53:25 +00:00
refactor: use tabs instead of spaces
This commit is contained in:
@@ -1,28 +1,28 @@
|
||||
import { Collection, Link } from '~/types/app';
|
||||
|
||||
export const appendCollectionId = (
|
||||
url: string,
|
||||
collectionId?: Collection['id'] | null | undefined
|
||||
url: string,
|
||||
collectionId?: Collection['id'] | null | undefined
|
||||
) => `${url}${collectionId ? `?collectionId=${collectionId}` : ''}`;
|
||||
|
||||
export const appendLinkId = (
|
||||
url: string,
|
||||
linkId?: Link['id'] | null | undefined
|
||||
url: string,
|
||||
linkId?: Link['id'] | null | undefined
|
||||
) => `${url}${linkId ? `?linkId=${linkId}` : ''}`;
|
||||
|
||||
export const appendResourceId = (
|
||||
url: string,
|
||||
resourceId?: Collection['id'] | Link['id']
|
||||
url: string,
|
||||
resourceId?: Collection['id'] | Link['id']
|
||||
) => `${url}${resourceId ? `/${resourceId}` : ''}`;
|
||||
|
||||
export function isValidHttpUrl(urlParam: string) {
|
||||
let url;
|
||||
let url;
|
||||
|
||||
try {
|
||||
url = new URL(urlParam);
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
url = new URL(urlParam);
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return url.protocol === 'http:' || url.protocol === 'https:';
|
||||
return url.protocol === 'http:' || url.protocol === 'https:';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user