Skip to content

Commit

Permalink
Merge pull request epiphone#37 from epiphone/fix-meta-mutation
Browse files Browse the repository at this point in the history
Avoid mutating metadata validation objects
  • Loading branch information
epiphone authored May 6, 2020
2 parents ed3c23b + 394edfb commit 68b5be5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,18 @@ function getMetadatasFromStorage(
'constraintMetadatas'
)

for (const meta of metadatas) {
return metadatas.map((meta) => {
if (meta.constraintCls) {
const constraint = constraints.find(
(c) => c.target === meta.constraintCls
)
if (constraint) {
meta.type = constraint.name
return { ...meta, type: constraint.name }
}
}
}

return metadatas
return meta
})
}

/**
Expand Down

0 comments on commit 68b5be5

Please sign in to comment.