handling is string an url
This commit is contained in:
parent
8eee747a3b
commit
1c65b5b237
@ -7,3 +7,8 @@ export function handleAxiosError(error: AxiosError) {
|
||||
export function enumKeys<O extends object, K extends keyof O = keyof O>(obj: O): K[] {
|
||||
return Object.keys(obj).filter(k => Number.isNaN(+k)) as K[];
|
||||
}
|
||||
|
||||
export function isUrl(val: string): boolean {
|
||||
var urlPattern = /^https:\/\/[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/;
|
||||
return urlPattern.test(val);
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
import useAutosizeTextArea from "./useAutosizeTextArea";
|
||||
import { handleAxiosError, enumKeys } from "./common";
|
||||
import { handleAxiosError, enumKeys, isUrl } from "./common";
|
||||
|
||||
export {
|
||||
useAutosizeTextArea,
|
||||
handleAxiosError,
|
||||
enumKeys,
|
||||
isUrl
|
||||
}
|
Loading…
Reference in New Issue
Block a user