Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {isNil} from 'ramda';
- export function dispatch(...funcs) {
- return function(...args) {
- for (let fun of funcs) {
- let ret = fun(...args);
- if (!isNil(ret)) return ret;
- }
- return undefined;
- };
- }
- // USAGE
- dispatch(
- dispatchAuthStarted,
- dispatchAuthCompleted,
- dispatchAuthFailed,
- defaultAction
- )('value');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement