Created
March 1, 2019 16:00
-
-
Save lucaronca/57ea17f61b7ebb3bac810dd47bd40d1d to your computer and use it in GitHub Desktop.
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 pipeActions = reducer => (...actions) => { | |
const getStateAfterActions = (state, actionToExecute, ...actions) => { | |
return actionToExecute ? | |
getStateAfterActions(reducer(state, actionToExecute), ...actions) : | |
state; | |
}; | |
return getStateAfterActions(undefined, ...actions); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment