MCPcopy
hub / github.com/validatorjs/validator.js / cleanUpProtocol

Function cleanUpProtocol

src/lib/isURL.js:93–104  ·  view source on GitHub ↗
(potential_protocol)

Source from the content-addressed store, hash-verified

91 let had_explicit_protocol = false;
92
93 const cleanUpProtocol = (potential_protocol) => {
94 had_explicit_protocol = true;
95 protocol = potential_protocol.toLowerCase();
96
97 if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) {
98 // The identified protocol is not in the allowed list.
99 return false;
100 }
101
102 // Remove the protocol from the URL string.
103 return url.substring(protocol_match[0].length);
104 };
105
106 if (protocol_match) {
107 const potential_protocol = protocol_match[1];

Callers 1

isURLFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected