mirror of
https://github.com/LukeHagar/arbiter.git
synced 2025-12-09 12:27:48 +00:00
Saving all progress
This commit is contained in:
18
node_modules/is-absolute-url/index.js
generated
vendored
Normal file
18
node_modules/is-absolute-url/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// Scheme: https://tools.ietf.org/html/rfc3986#section-3.1
|
||||
// Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3
|
||||
const ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/;
|
||||
|
||||
// Windows paths like `c:\`
|
||||
const WINDOWS_PATH_REGEX = /^[a-zA-Z]:\\/;
|
||||
|
||||
export default function isAbsoluteUrl(url) {
|
||||
if (typeof url !== 'string') {
|
||||
throw new TypeError(`Expected a \`string\`, got \`${typeof url}\``);
|
||||
}
|
||||
|
||||
if (WINDOWS_PATH_REGEX.test(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ABSOLUTE_URL_REGEX.test(url);
|
||||
}
|
||||
Reference in New Issue
Block a user