utils.ts 303 Bytes
Newer Older
1
/* eslint no-useless-escape:0 import/prefer-default-export:0 */
2
const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
3 4 5 6

export function isUrl(path) {
  return reg.test(path);
}