bindActionCreators.js 523 B

123456789101112131415161718192021222324
  1. "use strict";
  2. exports.__esModule = true;
  3. exports["default"] = bindActionCreators;
  4. function bindActionCreators(actionCreators, dispatch) {
  5. var boundActionCreators = {};
  6. var _loop = function _loop(key) {
  7. var actionCreator = actionCreators[key];
  8. if (typeof actionCreator === 'function') {
  9. boundActionCreators[key] = function () {
  10. return dispatch(actionCreator.apply(void 0, arguments));
  11. };
  12. }
  13. };
  14. for (var key in actionCreators) {
  15. _loop(key);
  16. }
  17. return boundActionCreators;
  18. }