You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
787 B
17 lines
787 B
2 years ago
|
import warning from '../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')) {
|
||
|
warning("The selector for " + methodName + " of " + displayName + " did not specify a value for dependsOnOwnProps.");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default function verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, displayName) {
|
||
|
verify(mapStateToProps, 'mapStateToProps', displayName);
|
||
|
verify(mapDispatchToProps, 'mapDispatchToProps', displayName);
|
||
|
verify(mergeProps, 'mergeProps', displayName);
|
||
|
}
|