Skip to content

Commit

Permalink
chore: use is-local-address instead of localhost-url-regex
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Feb 15, 2025
1 parent 4ad9db9 commit a6c325b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"dependencies": {
"@microlink/mql": "~0.13.14",
"clipboardy": "~2.3.0",
"is-local-address": "~2.0.0",
"jsome": "~2.5.0",
"localhost-url-regex": "~1.0.13",
"mri": "~1.2.0",
"nanospinner": "~1.2.2",
"picocolors": "~1.1.1",
Expand Down
11 changes: 7 additions & 4 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

require('update-notifier')({ pkg: require('../package.json') }).notify()

const localhostUrl = require('localhost-url-regex')
const { URLSearchParams } = require('url')
const clipboardy = require('clipboardy')
const mql = require('@microlink/mql')
Expand All @@ -22,9 +21,13 @@ const microlinkUrl = () =>

const normalizeInput = input => {
if (!input) return input
;[microlinkUrl, localhostUrl].forEach(
regex => (input = input.replace(regex(), ''))
)
;[
microlinkUrl,
() => require('is-local-address/ipv4').regex,
() => require('is-local-address/ipv6').regex
].forEach(regex => {
return (input = input.replace(regex(), ''))
})
return input.replace(/^\??url=/, '')
}

Expand Down

0 comments on commit a6c325b

Please sign in to comment.