@veecode-platform/safira-cli
Version:
Generate a microservice project from your spec.
36 lines (35 loc) • 876 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.StringValidator = void 0;
const url_1 = require("url");
class StringValidator {
static notEmpty(input) {
return input?.length > 0;
}
static greaterThan(input, length) {
return input?.length > length;
}
static lessThan(input, length) {
return input?.length < length;
}
static isUrl(input) {
try {
new url_1.URL(input);
return true;
}
catch {
return false;
}
}
static hasBreakLine(input) {
if (input)
return false;
return /\r|\n/g.test(input);
}
static hasMultiLines(input) {
if (!input)
return false;
return input.split(/\r\n|\r|\n/g).length !== 1;
}
}
exports.StringValidator = StringValidator;