1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = throwIfNonAllowedProtocol;
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | const ALLOWED_PROTOCOLS = ['http:', 'https:', 'devtools:', 'flipper:'];
|
12 | function throwIfNonAllowedProtocol(url) {
|
13 | const _url = new URL(url);
|
14 | const urlProtocol = _url.protocol;
|
15 | if (!ALLOWED_PROTOCOLS.includes(urlProtocol)) {
|
16 | throw new Error(`Invalid url protocol ${urlProtocol}.\nAllowed protocols: ${ALLOWED_PROTOCOLS.join(', ')}`);
|
17 | }
|
18 | }
|
19 |
|
20 |
|
\ | No newline at end of file |