Last active
December 4, 2017 05:45
-
-
Save ccapndave/b6d9e61ecf45322fe8115f19783598d6 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
// 1. Very functional but hard to read | |
const newState = stateTransformers.reduce((s, stateTransformer) => s.then(stateTransformer), Promise.resolve(state)); | |
// 2. Easy to read, but has mutation | |
let state = startingState; | |
for (let stateTransfomer of stateTransformers) { | |
state = await stateTransfomer(state); | |
} | |
// 3. ??? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment