@sync-in/server
Version:
The secure, open-source platform for file storage, sharing, collaboration, and sync
35 lines (34 loc) • 1.15 kB
JavaScript
/*
* Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>
* This file is part of Sync-in | The open source file sync and share solution
* See the LICENSE file for licensing details
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "RejectIfMatch", {
enumerable: true,
get: function() {
return RejectIfMatch;
}
});
const _classvalidator = require("class-validator");
function RejectIfMatch(regex, validationOptions) {
return function(object, propertyName) {
(0, _classvalidator.registerDecorator)({
name: 'RejectIfMatch',
target: object.constructor,
propertyName: propertyName,
options: validationOptions,
validator: {
validate (value, _args) {
return typeof value === 'string' && !regex.test(value);
},
defaultMessage (args) {
return `${args.property} ne doit pas correspondre à ${regex}`;
}
}
});
};
}
//# sourceMappingURL=decorators.js.map