Skip to content

Commit

Permalink
Move normalized type descriptor creation to separate function
Browse files Browse the repository at this point in the history
  • Loading branch information
talyssonoc committed Mar 25, 2018
1 parent 2d87c84 commit 1a7c4e9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/typeDescriptor/index.js
Expand Up @@ -14,7 +14,7 @@ function normalizeTypeDescriptor(schemaOptions, typeDescriptor, attributeName) {
}

function normalizeCompleteTypeDescriptor(schemaOptions, typeDescriptor, attributeName) {
if (isDynamicTypeDescriptor(typeDescriptor)) {
if(isDynamicTypeDescriptor(typeDescriptor)) {
typeDescriptor = addDynamicTypeGetter(schemaOptions, typeDescriptor, attributeName);
}

Expand All @@ -26,6 +26,10 @@ function normalizeCompleteTypeDescriptor(schemaOptions, typeDescriptor, attribut
);
}

return createNormalizedTypeDescriptor(typeDescriptor);
}

function createNormalizedTypeDescriptor(typeDescriptor) {
return Object.assign({}, typeDescriptor, {
coerce: Coercion.for(typeDescriptor, typeDescriptor.itemType),
validation: Validation.forAttribute(typeDescriptor)
Expand Down

0 comments on commit 1a7c4e9

Please sign in to comment.