19 lines
454 B
JavaScript
19 lines
454 B
JavaScript
|
export default function bindActionCreators(actionCreators, dispatch) {
|
||
|
var boundActionCreators = {};
|
||
|
|
||
|
var _loop = function _loop(key) {
|
||
|
var actionCreator = actionCreators[key];
|
||
|
|
||
|
if (typeof actionCreator === 'function') {
|
||
|
boundActionCreators[key] = function () {
|
||
|
return dispatch(actionCreator.apply(void 0, arguments));
|
||
|
};
|
||
|
}
|
||
|
};
|
||
|
|
||
|
for (var key in actionCreators) {
|
||
|
_loop(key);
|
||
|
}
|
||
|
|
||
|
return boundActionCreators;
|
||
|
}
|