Skip to content

Commit

Permalink
Use Array.prototype.find instead of filter()[0]
Browse files Browse the repository at this point in the history
  • Loading branch information
gnidan committed Jun 18, 2019
1 parent 926c525 commit 6223be9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/truffle-compile/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,10 @@ function replaceLinkReferences(bytecode, linkReferences, libraryName) {
function orderABI({ abi, contract_name: contractName, ast }) {
// AST can have multiple contract definitions, make sure we have the
// one that matches our contract
const contractDefinition = ast.nodes.filter(
const contractDefinition = ast.nodes.find(
({ nodeType, name }) =>
nodeType === "ContractDefinition" && name === contractName
)[0];
);

if (!contractDefinition || !contractDefinition.nodes) {
return abi;
Expand Down

0 comments on commit 6223be9

Please sign in to comment.