Skip to content

Commit

Permalink
Optimize loop
Browse files Browse the repository at this point in the history
  • Loading branch information
vishvamsinh28 committed Nov 29, 2024
1 parent 4123ed4 commit 7f7ce0d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions scripts/tools/tools-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ async function convertTools(data) {
const dataArray = data.items;

// initialising finalToolsObject with all categories inside it with proper elements in each category
finalToolsObject = categoryList.reduce((acc, category) => ({
...acc,
[category.name]: {
description: category.description,
toolsList: []
}
}), {});
finalToolsObject = Object.fromEntries(
categoryList.map(category => [
category.name,
{
description: category.description,
toolsList: []
}
])
);

await Promise.all(dataArray.map(async (tool) => {
try {
Expand Down

0 comments on commit 7f7ce0d

Please sign in to comment.