Files
hackathon-v-escape-4ff8b5a6…/frontend/node_modules/@react-native-community/cli-tools/build/throwIfNonAllowedProtocol.js
marianesaldana 80dbd947e5 Initial commit
2026-05-23 08:59:34 -06:00

20 lines
580 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = throwIfNonAllowedProtocol;
/**
* Check if a url uses an allowed protocol
*/
const ALLOWED_PROTOCOLS = ['http:', 'https:', 'devtools:', 'flipper:'];
function throwIfNonAllowedProtocol(url) {
const _url = new URL(url);
const urlProtocol = _url.protocol;
if (!ALLOWED_PROTOCOLS.includes(urlProtocol)) {
throw new Error(`Invalid url protocol ${urlProtocol}.\nAllowed protocols: ${ALLOWED_PROTOCOLS.join(', ')}`);
}
}
//# sourceMappingURL=throwIfNonAllowedProtocol.ts.map