Skip to content

Commit

Permalink
hot fix
Browse files Browse the repository at this point in the history
  • Loading branch information
avkos committed Mar 6, 2024
1 parent f7f82d7 commit 9fc3957
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 5 additions & 4 deletions packages/web3-utils/src/objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,19 @@ export const mergeDeep = (
destination: Record<string, unknown>,
...sources: Record<string, unknown>[]
): Record<string, unknown> => {
const result = { ...destination }; // clone deep here
if (!isIterable(result)) {
return result;
if (!isIterable(destination)) {
return destination;

Check warning on line 40 in packages/web3-utils/src/objects.ts

View check run for this annotation

Codecov / codecov/patch

packages/web3-utils/src/objects.ts#L40

Added line #L40 was not covered by tests
}
const result = { ...destination }; // clone deep here
for (const src of sources) {
// const src = { ..._src };
// eslint-disable-next-line no-restricted-syntax
for (const key in src) {
if (isIterable(src[key])) {
if (!result[key]) {
result[key] = {};
}
mergeDeep(
result[key] = mergeDeep(
result[key] as Record<string, unknown>,
src[key] as Record<string, unknown>,
);
Expand Down
4 changes: 1 addition & 3 deletions packages/web3-utils/test/unit/objects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ import { objectBigintToString } from '../fixtures/system_test_utils';
describe('objects', () => {
describe('mergeDeep', () => {
it.each(mergeDeepData)('$message', ({ destination, sources, output }) => {
mergeDeep(destination, ...sources);

expect(objectBigintToString(destination)).toEqual(objectBigintToString(output));
expect(mergeDeep(destination, ...sources)).toEqual(output);
});

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

1 comment on commit 9fc3957

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 9fc3957 Previous: 6c075db Ratio
processingTx 9616 ops/sec (±4.09%) 9301 ops/sec (±4.81%) 0.97
processingContractDeploy 40731 ops/sec (±6.48%) 39129 ops/sec (±7.62%) 0.96
processingContractMethodSend 19394 ops/sec (±7.16%) 19443 ops/sec (±5.19%) 1.00
processingContractMethodCall 39972 ops/sec (±5.62%) 38971 ops/sec (±6.34%) 0.97
abiEncode 44212 ops/sec (±6.83%) 44252 ops/sec (±6.92%) 1.00
abiDecode 31267 ops/sec (±7.66%) 30419 ops/sec (±8.89%) 0.97
sign 1609 ops/sec (±3.91%) 1656 ops/sec (±4.08%) 1.03
verify 371 ops/sec (±0.72%) 373 ops/sec (±0.78%) 1.01

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.