diff --git a/src/utils.ts b/src/utils.ts index 3c8f7f93..cae821dd 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -43,6 +43,12 @@ export function hasProtocol( ); } +const PROTOCOL_SCRIPT_RE = /^(blob|data|javascript|vbscript):$/; + +export function isScriptProtocol(protocol?: string) { + return !!protocol && PROTOCOL_SCRIPT_RE.test(protocol); +} + const TRAILING_SLASH_RE = /\/$|\/\?/; export function hasTrailingSlash(input = "", queryParameters = false): boolean {