steadybit
Version:
Command-line interface to interact with the Steadybit API
22 lines • 743 B
JavaScript
;
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2022 Steadybit GmbH
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateNotBlank = validateNotBlank;
exports.validateHttpUrl = validateHttpUrl;
function validateNotBlank(input) {
return input != null && input.trim().length > 0;
}
function validateHttpUrl(input) {
try {
const url = new URL(input);
if (url.protocol !== 'http:' && url.protocol !== 'https:') {
return `Unsupported protocol ${url.protocol}. Only http: and https: are supported.`;
}
return true;
}
catch (_a) {
return 'Invalid URL. Please specify an absolute URL.';
}
}
//# sourceMappingURL=validation.js.map