26 lines
997 B
JavaScript
26 lines
997 B
JavaScript
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
exports.default = verifySubselectors;
|
|
|
|
var _warning = require('../utils/warning');
|
|
|
|
var _warning2 = _interopRequireDefault(_warning);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function verify(selector, methodName, displayName) {
|
|
if (!selector) {
|
|
throw new Error('Unexpected value for ' + methodName + ' in ' + displayName + '.');
|
|
} else if (methodName === 'mapStateToProps' || methodName === 'mapDispatchToProps') {
|
|
if (!selector.hasOwnProperty('dependsOnOwnProps')) {
|
|
(0, _warning2.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);
|
|
} |