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

11 lines
377 B
JavaScript
Raw Normal View History

2018-02-27 13:55:59 +00:00
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);
};
};