Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
remove "path.indexOf(/) === 0"
Browse files Browse the repository at this point in the history
fix #40
  • Loading branch information
chenshuai2144 committed Jul 1, 2019
1 parent 615e410 commit b2cca7f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -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';

1 comment on commit b2cca7f

@xiuyangzhe
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还是不行

Please sign in to comment.