MCPcopy
hub / github.com/ampproject/amphtml / validateSrcPrefix

Function validateSrcPrefix

3p/3p.js:132–145  ·  view source on GitHub ↗
(prefix, src)

Source from the content-addressed store, hash-verified

130 * @param {string} src
131 */
132export function validateSrcPrefix(prefix, src) {
133 if (!isArray(prefix)) {
134 prefix = [prefix];
135 }
136 if (src !== undefined) {
137 for (let p = 0; p < prefix.length; p++) {
138 const protocolIndex = src.indexOf(prefix[p]);
139 if (protocolIndex == 0) {
140 return;
141 }
142 }
143 }
144 throw new Error('Invalid src ' + src);
145}
146
147/**
148 * Throws if the given src doesn't contain the string

Callers 14

test-3p.jsFile · 0.90
rnetplusFunction · 0.90
ibillboardFunction · 0.90
dynadFunction · 0.90
tripleliftFunction · 0.90
ligatusFunction · 0.90
nwsFunction · 0.90
chargeadsFunction · 0.90
purchFunction · 0.90
adtechFunction · 0.90
rbinfoxFunction · 0.90
onnetworkFunction · 0.90

Calls 1

isArrayFunction · 0.85

Tested by

no test coverage detected