salix/services/loopback/common/methods/vn-model/validateBinded.js

11 lines
377 B
JavaScript

module.exports = function(Self) {
Self.validateBinded = function(propertyName, validatorFn, options) {
var customValidator = function(err) {
if (!validatorFn(this[propertyName])) err();
};
options.isExportable = true;
options.bindedFunction = validatorFn;
this.validate(propertyName, customValidator, options);
};
};