From 67d9ae524c3eca70c3023e33a530836222eff6a4 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Tue, 27 Aug 2024 22:51:41 +0200 Subject: [PATCH] Optimize deepClone function even more --- src/utils/deepClone.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/utils/deepClone.js b/src/utils/deepClone.js index 4f21e63..b306ae3 100644 --- a/src/utils/deepClone.js +++ b/src/utils/deepClone.js @@ -27,12 +27,10 @@ function deepClone(obj) { _objectsArray.push(obj); _clonesArray.push(clone); Object.keys(obj).forEach((key) => { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - clone[key] = - typeof obj[key] !== "object" || obj[key] === null - ? obj[key] - : recurse(obj[key], _objectsArray, _clonesArray); - } + clone[key] = + typeof obj[key] !== "object" || obj[key] === null + ? obj[key] + : recurse(obj[key], _objectsArray, _clonesArray); }); } return clone;