Skip to content

Commit 5a2b44d

Browse files
authored
feat: drop url dependency (#334)
- Fixes #330 URL has been a global for a VERY long time.
1 parent fc48e17 commit 5a2b44d

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

lib/parse-url.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
const url = require('url')
2-
31
const lastIndexOfBefore = (str, char, beforeChar) => {
42
const startPosition = str.indexOf(beforeChar)
53
return str.lastIndexOf(char, startPosition > -1 ? startPosition : Infinity)
64
}
75

86
const safeUrl = (u) => {
97
try {
10-
return new url.URL(u)
8+
return new URL(u)
119
} catch {
1210
// this fn should never throw
1311
}

0 commit comments

Comments
 (0)