Skip to content

Commit

Permalink
feat: add isScriptProtocol util (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Jul 28, 2023
1 parent 7fa45a0 commit b982937
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b982937

Please sign in to comment.