Skip to content

Commit

Permalink
Fix small util bugs (#1871)
Browse files Browse the repository at this point in the history
* Fix small util bugs

* Delete console.log
  • Loading branch information
Twixes committed Oct 14, 2020
1 parent 0370a42 commit 19adefc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Expand Up @@ -52,7 +52,7 @@ const FilterRow = React.memo(function FilterRow({
</Button>
)}
</Popover>
{Object.keys(filters[index]).length && (
{!!Object.keys(filters[index]).length && (
<CloseButton
className="ml-1"
onClick={() => {
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/lib/utils.tsx
Expand Up @@ -377,9 +377,8 @@ export function stripHTTP(url: string): string {
export function isURL(string: string): boolean {
if (!string) return false
// https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url
const expression = /^\s*https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi
const regex = new RegExp(expression)
return !!string.match(regex)
const regexp = /^\s*https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi
return !!string.match?.(regexp)
}

export function eventToName(event: EventType): string {
Expand Down

0 comments on commit 19adefc

Please sign in to comment.