From 309750b3e2bbaec6f1b076d20448df0d5ab03c09 Mon Sep 17 00:00:00 2001 From: George Goodall Date: Mon, 21 Oct 2024 12:51:55 +0100 Subject: [PATCH] dont use delete for better performance --- src/middleware/common.middleware.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/middleware/common.middleware.js b/src/middleware/common.middleware.js index 121dcb31..64cefc70 100644 --- a/src/middleware/common.middleware.js +++ b/src/middleware/common.middleware.js @@ -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 @@ -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 } }) })