From 0a9c81772fcb32e4ac1f32b07b0297ec5908d38c Mon Sep 17 00:00:00 2001 From: GyDi Date: Mon, 28 Mar 2022 00:56:48 +0800 Subject: [PATCH] fix: change to deep copy --- src/utils/ignore-case.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/ignore-case.ts b/src/utils/ignore-case.ts index d817d4e1c6..aadf22e06b 100644 --- a/src/utils/ignore-case.ts +++ b/src/utils/ignore-case.ts @@ -1,4 +1,4 @@ -// Shallow copy and change all keys to lowercase +// Deep copy and change all keys to lowercase type TData = Record; export default function ignoreCase(data: TData): TData { @@ -6,8 +6,8 @@ export default function ignoreCase(data: TData): TData { const newData = {} as TData; - Object.keys(data).forEach((key) => { - newData[key.toLowerCase()] = data[key]; + Object.entries(data).forEach(([key, value]) => { + newData[key.toLowerCase()] = JSON.parse(JSON.stringify(value)); }); return newData;