From f127f024a61d0406e1dc24eece9c4c5567e996cf Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 9 Apr 2019 08:58:17 -0400 Subject: [PATCH] improve clarity on og filename find --- lib/Compiler.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Compiler.js b/lib/Compiler.js index e6b24c1..a4f0e13 100644 --- a/lib/Compiler.js +++ b/lib/Compiler.js @@ -182,9 +182,10 @@ function compileSolc(embark, contractFiles, contractDirectories, options, callba compiledObject[className].userdoc = contract.userdoc; compiledObject[className].filename = filename; const normalized = path.normalize(filename); - compiledObject[className].originalFilename = path.normalize(contractFiles.find(contractFile => { - return normalized.indexOf(path.normalize(contractFile.originalPath)) > -1; - }).originalPath); + const origContract = contractFiles.find(contractFile => normalized.includes(path.normalize(contractFile.originalPath))); + if (origContract) { + compiledObject[className].originalFilename = path.normalize(origContract.originalPath); + } } }