Last active
September 10, 2021 16:26
-
-
Save brycetshaw/5604e71c5b42f31517b631511b608ebd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
async function getTiesCountByNumberOfGoals(year, goals) { | |
const [gamesOnFirstPage, numberOfPages] = await getNumOfGamesFromPage(year, goals, 0); | |
const pageArray = Array.from(Array(numberOfPages).keys()).filter((e) => e !== 0); | |
return Promise.all( | |
[ | |
gamesOnFirstPage, | |
...pageArray.map(page => getNumOfGamesFromPage(year, goals, page)) | |
]) | |
).then(data => data.reduce((x, y) => x + y, 0) || 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment