@kerthin/domain
Version:
Kerthin Domain (based on DDD)
14 lines • 632 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MinLength = void 0;
const isLength_1 = require("validator/lib/isLength");
const apply_validation_1 = require("./apply-validation");
const MinLength = (min, validationOptions) => (0, apply_validation_1.applyValidation)({
code: 'MIN_LENGTH',
defaultMessage: `The value must be longer than or equal to ${min} characters`,
validate: (value) => {
return typeof value === 'string' && (0, isLength_1.default)(value, { min });
}
}, validationOptions);
exports.MinLength = MinLength;
//# sourceMappingURL=min-length.validator.js.map