Skip to content

Commit

Permalink
dont use delete for better performance
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGoodall committed Oct 21, 2024
1 parent 7a92376 commit 309750b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/middleware/common.middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export const extractJsonFieldFromEntities = (req, res, next) => {
logger.info(`common.middleware/extractJsonField: No json field for entity ${entity.toString()}`)
return entity
}
delete entity.json
entity.json = undefined
const parsedJson = JSON.parse(jsonField)
entity = { ...entity, ...parsedJson }
return entity
Expand All @@ -251,7 +251,7 @@ export const replaceUnderscoreWithHyphenForEntities = (req, res, next) => {
if (key.includes('_')) {
const newKey = key.replace(/_/g, '-')
entity[newKey] = entity[key]
delete entity[key]
entity[key] = undefined
}
})
})
Expand Down

0 comments on commit 309750b

Please sign in to comment.