24 lines
999 B
JavaScript
24 lines
999 B
JavaScript
|
"use strict";
|
||
|
|
||
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
||
|
|
||
|
exports.__esModule = true;
|
||
|
exports["default"] = verifySubselectors;
|
||
|
|
||
|
var _warning = _interopRequireDefault(require("../utils/warning"));
|
||
|
|
||
|
function verify(selector, methodName, displayName) {
|
||
|
if (!selector) {
|
||
|
throw new Error("Unexpected value for " + methodName + " in " + displayName + ".");
|
||
|
} else if (methodName === 'mapStateToProps' || methodName === 'mapDispatchToProps') {
|
||
|
if (!Object.prototype.hasOwnProperty.call(selector, 'dependsOnOwnProps')) {
|
||
|
(0, _warning["default"])("The selector for " + methodName + " of " + displayName + " did not specify a value for dependsOnOwnProps.");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, displayName) {
|
||
|
verify(mapStateToProps, 'mapStateToProps', displayName);
|
||
|
verify(mapDispatchToProps, 'mapDispatchToProps', displayName);
|
||
|
verify(mergeProps, 'mergeProps', displayName);
|
||
|
}
|