Skip to content

Instantly share code, notes, and snippets.

@visualjeff
Created August 13, 2024 21:16
Show Gist options
  • Save visualjeff/e12d6240438113e053d33bfa7a38a070 to your computer and use it in GitHub Desktop.
Save visualjeff/e12d6240438113e053d33bfa7a38a070 to your computer and use it in GitHub Desktop.
Buggy code
const productApiResponses = await Promise.all(
itemNumbers.map(async (itemNumber: string) => {
try {
const productAPIResponse = await productService(
itemNumber,
productConfig,
locale
);
if (!productAPIResponse) return null;
return {
...productAPIResponse,
itemNumber
};
} catch (err) {
console.log(err);
return null;
}
})
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment