Skip to content

Commit

Permalink
updated config
Browse files Browse the repository at this point in the history
  • Loading branch information
veritem committed Mar 22, 2021
1 parent 2e436b3 commit bf94f56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/isUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import ErrorMessage from './utils/Error'

const expression = /[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)?/gi
const regex = new RegExp(expression)
/* eslint-disable */
const regex = new RegExp(
/[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)?/gi
)

//returns the url
export function isURL(url_str: String) {
export function isURL(url_str: string): boolean {
if (!url_str.match(regex)) ErrorMessage(url_str, 'email')
return true
}
2 changes: 1 addition & 1 deletion src/utils/Error.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default function ErrorMessage(value: unknown, key: unknown): string {
throw new Error('value'+value+' is not a valid '+key)
throw new Error('value' + value + ' is not a valid ' + key)
}

0 comments on commit bf94f56

Please sign in to comment.