Skip to content

Commit

Permalink
build: use is-localhost-url package
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Apr 26, 2020
1 parent ae4be85 commit 5057468
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
],
"dependencies": {
"@microlink/mql": "~0.6.12",
"is-localhost-url": "~1.0.0",
"nanoclamp": "~1.3.3"
},
"devDependencies": {
Expand Down
7 changes: 3 additions & 4 deletions packages/react/src/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { css } from 'styled-components'
import { fetchFromApi, getApiUrl as createApiUrl } from '@microlink/mql'

const REGEX_LOCALHOST = /http:\/\/localhost/
import isLocalhostUrl from 'is-localhost-url'
import { css } from 'styled-components'

export const isSSR = typeof window === 'undefined'

Expand Down Expand Up @@ -82,7 +81,7 @@ export const isLarge = cardSize => cardSize === 'large'
export const isSmall = cardSize => cardSize === 'small'

export const imageProxy = url =>
REGEX_LOCALHOST.test(url)
isLocalhostUrl(url)
? url
: `https://images.weserv.nl/?url=${encodeURIComponent(url)}&l=9&af&il&n=-1`

Expand Down

0 comments on commit 5057468

Please sign in to comment.