(prefix, src)
| 130 | * @param {string} src |
| 131 | */ |
| 132 | export 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 |
no test coverage detected