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
const rootReducer = (...reducers) => { | |
return (stateInit, action) => { | |
return reducers.reduce( | |
(state, reducer, at) => { | |
return reducer(state, action) || state | |
}, | |
stateInit | |
); | |
} | |
}; |
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
type Predicate<T> = (x: T) => boolean; | |
/** | |
* Usage: | |
* ```typescript | |
* const factory = when(something) | |
* .match( (x) => someLogicReturningTrue ) | |
* .then( () => anyLogicToProduceResult ) | |
* .byDefault( () => defaultLogicWhenNoMatches ) | |
* |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
OlderNewer