From 63633d1de15ee99d428d6918bf70daea78c01b49 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Tue, 27 Aug 2024 22:52:36 +0200 Subject: [PATCH] Fix the deepClone function --- src/utils/deepClone.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/deepClone.js b/src/utils/deepClone.js index b306ae3..b344bc7 100644 --- a/src/utils/deepClone.js +++ b/src/utils/deepClone.js @@ -20,7 +20,10 @@ function deepClone(obj) { _objectsArray.push(obj); _clonesArray.push(clone); obj.forEach((item, index) => { - clone[index] = recurse(item, _objectsArray, _clonesArray); + clone[index] = + typeof item !== "object" || item === null + ? item + : recurse(item, _objectsArray, _clonesArray); }); } else { clone = {};