Skip to content

Commit

Permalink
chore: re-order for perf
Browse files Browse the repository at this point in the history
  • Loading branch information
Hieuzest committed Nov 4, 2024
1 parent 9464c72 commit 63c6513
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,12 @@ export class Model<S = any> {
const result = {}
for (const key in obj) {
const type = Type.getInner(model, key)
if (!type || isNullable(obj[key]) || isEvalExpr(obj[key])) {
if (!type || isNullable(obj[key])) {
result[key] = obj[key]
} else if (type.type !== 'json') {
result[key] = this.resolveValue(type, obj[key])
} else if (isEvalExpr(obj[key])) {
result[key] = obj[key]
} else if (type.inner && Type.isArray(type) && Array.isArray(obj[key])) {
result[key] = obj[key].map(x => this.resolveModel(x, Type.getInner(type)))
} else if (type.inner) {
Expand Down

0 comments on commit 63c6513

Please sign in to comment.