Skip to content

Commit

Permalink
change to mergeDeep functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Esummins committed May 24, 2024
1 parent 54d020d commit 0a7173d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/contexts/players-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ export function mergeDeep(target: any, ...sources: any[]): any {

if (isObject(target) && isObject(source)) {
for (const key in source) {
if (isObject(source[key])) {
if (Array.isArray(source[key])) {
newTarget[key] = source[key];
} else if (isObject(source[key])) {
if (!target[key]) {
newTarget[key] = Array.isArray(source[key]) ? [] : {};
}
Expand Down

0 comments on commit 0a7173d

Please sign in to comment.