Created
July 11, 2020 05:27
-
-
Save drewrothstein/bf9c458467d73970b57adab60ca66b1c to your computer and use it in GitHub Desktop.
.then() gets pretty old pretty fast
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
Promise.resolve(skipPosting) | |
.then((res) => { | |
if ( res === 'skipPosting' ) { | |
throw new Error('skipPosting'); | |
} | |
}) | |
.then(() => { | |
const fromTs = ...; | |
let countOfQuestions = ...; | |
queryQuestions.get().then((querySnapshot) => { | |
querySnapshot.forEach((documentSnapshot) => { | |
countOfQuestions += 1; | |
}); | |
}) | |
.then(() => { | |
if (countOfQuestions === 0) { | |
msg.push(`...`); | |
} | |
}) | |
.then(() => { | |
let countOfAnswered = 0; | |
queryHero.get().then((querySnapshot) => { | |
querySnapshot.forEach((documentSnapshot) => { | |
const isResolvedAction = ...; | |
if (isResolvedAction) { | |
countOfAnswered += 1; | |
// ... | |
} | |
}); | |
}).then(() => { | |
... | |
... | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment