@sap-cloud-sdk/core
Version:
SAP Cloud SDK for JavaScript core
30 lines • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Protocol = void 0;
/* eslint-disable-next-line */
var Protocol;
(function (Protocol) {
Protocol["HTTP"] = "http";
Protocol["HTTPS"] = "https";
})(Protocol = exports.Protocol || (exports.Protocol = {}));
/* eslint-disable-next-line */
(function (Protocol) {
/**
* Get [[Protocol]] from its string representation.
* @param protocol - Protocol as string, either 'http'/'https' or 'http:'/'https:'.
* @returns Either the matching protocol or undefined
*/
function of(protocol) {
if (protocol.endsWith(':')) {
return of(protocol.slice(0, -1));
}
if (protocol.toLowerCase() === Protocol.HTTP) {
return Protocol.HTTP;
}
if (protocol.toLowerCase() === Protocol.HTTPS) {
return Protocol.HTTPS;
}
}
Protocol.of = of;
})(Protocol = exports.Protocol || (exports.Protocol = {}));
//# sourceMappingURL=protocol.js.map