UNPKG

class-validator-extended

Version:
29 lines (28 loc) 1.32 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NOT_MATCHES = void 0; exports.NotMatches = NotMatches; const class_validator_1 = require("class-validator"); const not_matches_predicate_1 = require("./not-matches.predicate"); /** @hidden */ exports.NOT_MATCHES = 'notMatches'; function NotMatches(pattern, modifiersOrOptions, options) { let modifiers; if (modifiersOrOptions && modifiersOrOptions instanceof Object && !options) { // biome-ignore lint/style/noParameterAssign: this is fine options = modifiersOrOptions; } else { modifiers = modifiersOrOptions; } return (0, class_validator_1.ValidateBy)({ name: exports.NOT_MATCHES, constraints: [pattern, modifiers], validator: { validate: (value, arguments_) => (0, not_matches_predicate_1.notMatches)(value, /* istanbul ignore next */ arguments_ === null || arguments_ === void 0 ? void 0 : arguments_.constraints[0], /* istanbul ignore next */ arguments_ === null || arguments_ === void 0 ? void 0 : arguments_.constraints[1]), defaultMessage: (0, class_validator_1.buildMessage)(eachPrefix => `${eachPrefix}$property must not match $constraint1 regular expression`, options), }, }, options); }