Created
June 7, 2021 20:02
-
-
Save agiron123/14cdd6e24d3075ed5cda5501b83278d0 to your computer and use it in GitHub Desktop.
flakyTemp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const temperatureUrlArray = [ | |
"best-data.json", | |
"average-data.json" , | |
"worst-data.json" | |
]; | |
Promise.allSettled(temperatureUrlArray.map((url) => get(url))) | |
.then((temperatureResults) => { | |
for (let i = 0; i < temperatureResults.length; i++) { | |
if (temperatureResults[i].status === 'fulfilled') { | |
return Promise.resolve(temperatureResults[i].value) | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment