MCPcopy Create free account
hub / github.com/ampproject/amphtml / isProtocolValid

Function isProtocolValid

src/preact/utils/url.js:41–44  ·  view source on GitHub ↗

* Returns whether the URL has valid protocol. * Deep link protocol is valid, but not javascript etc. * @param {string|!URL} url * @return {boolean}

(url)

Source from the content-addressed store, hash-verified

39 * @return {boolean}
40 */
41 isProtocolValid(url) {
42 const parsed = this.parse(url);
43 return !INVALID_PROTOCOLS.includes(parsed.protocol);
44 },
45
46 /**
47 * Asserts that a given url is HTTPS or protocol relative.

Callers 2

isProtocolValidMethod · 0.90

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected