Skip to content

Commit

Permalink
Make linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
talyssonoc committed Feb 22, 2019
1 parent e473f6e commit baeafac
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/validation/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ exports.mapToJoi = function mapToJoi(typeDescriptor, { initial, mappings }) {
return joiSchema;
}

if(passValueToJoi && (!isFunction(passValueToJoi) || passValueToJoi(attributeDescriptor))) {
if(shouldPassValueToJoi(passValueToJoi, attributeDescriptor)) {
return joiSchema[joiMethod](attributeDescriptor);
}

return joiSchema[joiMethod]();
}, initial);
};

function shouldPassValueToJoi(passValueToJoi, attributeDescriptor) {
return passValueToJoi && (!isFunction(passValueToJoi) || passValueToJoi(attributeDescriptor));
}

function mapValueOrReference(valueOrReference) {
if(isPlainObject(valueOrReference)) {
return joi.ref(valueOrReference.attr);
Expand Down

0 comments on commit baeafac

Please sign in to comment.