Skip to content

Commit 5c7a40b

Browse files
authored
cleaner by using reduce instead of forEach (#766)
1 parent 1dfcf59 commit 5c7a40b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/config/utils/compile-contract.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ function compileContract(filename, content) {
2525
}
2626

2727
const compiledContracts = output.contracts[filename];
28-
const bytecodes = {};
29-
Object.keys(compiledContracts).forEach((contractName) => {
30-
bytecodes[contractName] =
31-
compiledContracts[contractName].evm.bytecode.object;
32-
});
33-
return bytecodes;
28+
return Object.keys(compiledContracts).reduce(
29+
(byteCodes, contractName) => ({
30+
...byteCodes,
31+
[contractName]: compiledContracts[contractName].evm.bytecode.object,
32+
}),
33+
{}
34+
);
3435
}
3536

3637
module.exports = compileContract;

0 commit comments

Comments
 (0)