From 03e7f40cb5f99248ddcf7b59958fbb13f1295a05 Mon Sep 17 00:00:00 2001 From: Konstantina Blazhukova Date: Tue, 5 Sep 2023 13:08:06 +0300 Subject: [PATCH] Refactors main to make it more readable Signed-off-by: Konstantina Blazhukova --- scripts/check-ethereum-api-schema.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/check-ethereum-api-schema.js b/scripts/check-ethereum-api-schema.js index 6dd1071b49..dd9b07d8b5 100644 --- a/scripts/check-ethereum-api-schema.js +++ b/scripts/check-ethereum-api-schema.js @@ -86,7 +86,7 @@ async function getFolderContent(path) { return await getFileContent(dataEntry.path); })); - return fileContents; + return {method: path.split('/')[1], content: fileContents}; } function splitReqAndRes(content) { @@ -284,10 +284,8 @@ async function main() { const relaySupportedMethodNames = openRpcData.methods.map(method => method.name); const ethSupportedMethods = await getEthereumExecApis(relaySupportedMethodNames); const folders = ethSupportedMethods.map(each => each.path); - let fileContents = []; - for (const folder of folders) { - fileContents.push({method: folder.split('/')[1], content: await getFolderContent(folder)}); - } + + const fileContents = await Promise.all(folders.map(getFolderContent)); for (const file of fileContents) { console.log("Executing for method ", file.method);