nowjs-core
Version:
NowCanDo Javascript Core [nowjs-core] is a library written by TypeScript code maintains under Apache 2.0 licence
20 lines (19 loc) • 1.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("../index");
const index_2 = require("./index");
exports.VALIDATOR_NOTEQUALTO_METADATA_KEY = Symbol('validation:validator:isNotEqualTo');
function isNotEqualTo(anotherTarget, anotherPropertyName = '', errorMessage) {
return (target, propertyKey, descriptor) => {
const original = descriptor.value;
Reflect.defineMetadata(exports.VALIDATOR_NOTEQUALTO_METADATA_KEY, null, target, propertyKey);
Reflect.defineMetadata(index_1.VALIDATOR_METADATA_KEY, new NotEqualToValidator(anotherTarget, anotherPropertyName, errorMessage), target, propertyKey);
};
}
exports.isNotEqualTo = isNotEqualTo;
class NotEqualToValidator extends index_2.CompareToValidatorBase {
constructor(anotherTarget, anotherPropertyName = '', errorMessage = 'The value of ${DisplayName} must ${style} .') {
super('NotEqualTo', 'notEqual', anotherTarget, anotherPropertyName, errorMessage);
}
}
exports.NotEqualToValidator = NotEqualToValidator;