Clean code

This commit is contained in:
Adria Navarro 2023-08-01 12:03:43 +02:00
parent 624dc5ff26
commit 76cacfaff0
1 changed files with 10 additions and 8 deletions

View File

@ -18,16 +18,18 @@ async function parseSchemaUI(ctx: Ctx, view: CreateViewRequest) {
newObj: Record<string, any>, newObj: Record<string, any>,
existingObj: Record<string, any> existingObj: Record<string, any>
) { ) {
for (const [key, value] of Object.entries(newObj)) { const result = Object.entries(newObj).some(([key, value]) => {
if (typeof value === "object") { const isObject = typeof value === "object"
if (hasOverrides(value, existingObj[key] || {})) { const existing = existingObj[key]
if (isObject && hasOverrides(value, existing || {})) {
return true return true
} }
} else if (value !== existingObj[key]) { if (!isObject && value !== existing) {
return true return true
} }
} })
return false
return result
} }
const table = await sdk.tables.getTable(view.tableId) const table = await sdk.tables.getTable(view.tableId)