diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 41ef8303..aa73c8fa 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -1,8 +1,6 @@ /* eslint no-useless-escape:0 import/prefer-default-export:0 */ const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/; -export function isUrl(path: string): boolean { - return reg.test(path) || path.indexOf('/') === 0; -} +export const isUrl = (path: string): boolean => reg.test(path); export const isBrowser = () => typeof window !== 'undefined';