verifySubselectors.js 999 B

123456789101112131415161718192021222324
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
  3. exports.__esModule = true;
  4. exports["default"] = verifySubselectors;
  5. var _warning = _interopRequireDefault(require("../utils/warning"));
  6. function verify(selector, methodName, displayName) {
  7. if (!selector) {
  8. throw new Error("Unexpected value for " + methodName + " in " + displayName + ".");
  9. } else if (methodName === 'mapStateToProps' || methodName === 'mapDispatchToProps') {
  10. if (!Object.prototype.hasOwnProperty.call(selector, 'dependsOnOwnProps')) {
  11. (0, _warning["default"])("The selector for " + methodName + " of " + displayName + " did not specify a value for dependsOnOwnProps.");
  12. }
  13. }
  14. }
  15. function verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, displayName) {
  16. verify(mapStateToProps, 'mapStateToProps', displayName);
  17. verify(mapDispatchToProps, 'mapDispatchToProps', displayName);
  18. verify(mergeProps, 'mergeProps', displayName);
  19. }