Skip to content

Commit 6c026a9

Browse files
committed
refactor: rename mergeArraysByIndex function to clarify functionality
1 parent d6038fb commit 6c026a9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/commons/src/deepMerge.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ const isPlainObject = (value: unknown): value is Record<string, unknown> => {
1414
};
1515

1616
/**
17-
* Merge source array into target array by index.
17+
* Merge source array items into target array by index.
18+
*
19+
* When both source and target items at the same index are plain objects,
20+
* they are merged recursively. Otherwise, the source item replaces the target.
1821
*
1922
* @internal
2023
*/
21-
const mergeArraysByIndex = (
24+
const mergeArrayItemsByIndex = (
2225
targetArray: unknown[],
2326
sourceArray: unknown[],
2427
seen: WeakSet<object>
@@ -63,7 +66,7 @@ const handleArrayMerge = (
6366
return;
6467
}
6568

66-
mergeArraysByIndex(targetValue, sourceArray, seen);
69+
mergeArrayItemsByIndex(targetValue, sourceArray, seen);
6770
};
6871

6972
/**

0 commit comments

Comments
 (0)