Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 9fc3957

Browse files
committed
hot fix
1 parent f7f82d7 commit 9fc3957

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

packages/web3-utils/src/objects.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,19 @@ export const mergeDeep = (
3636
destination: Record<string, unknown>,
3737
...sources: Record<string, unknown>[]
3838
): Record<string, unknown> => {
39-
const result = { ...destination }; // clone deep here
40-
if (!isIterable(result)) {
41-
return result;
39+
if (!isIterable(destination)) {
40+
return destination;
4241
}
42+
const result = { ...destination }; // clone deep here
4343
for (const src of sources) {
44+
// const src = { ..._src };
4445
// eslint-disable-next-line no-restricted-syntax
4546
for (const key in src) {
4647
if (isIterable(src[key])) {
4748
if (!result[key]) {
4849
result[key] = {};
4950
}
50-
mergeDeep(
51+
result[key] = mergeDeep(
5152
result[key] as Record<string, unknown>,
5253
src[key] as Record<string, unknown>,
5354
);

packages/web3-utils/test/unit/objects.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ import { objectBigintToString } from '../fixtures/system_test_utils';
2222
describe('objects', () => {
2323
describe('mergeDeep', () => {
2424
it.each(mergeDeepData)('$message', ({ destination, sources, output }) => {
25-
mergeDeep(destination, ...sources);
26-
27-
expect(objectBigintToString(destination)).toEqual(objectBigintToString(output));
25+
expect(mergeDeep(destination, ...sources)).toEqual(output);
2826
});
2927

3028
it('should not mutate the sources', () => {

0 commit comments

Comments
 (0)