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.
18 lines
933 B
18 lines
933 B
2 years ago
|
import bindActionCreators from '../utils/bindActionCreators';
|
||
|
import { wrapMapToPropsConstant, wrapMapToPropsFunc } from './wrapMapToProps';
|
||
|
export function whenMapDispatchToPropsIsFunction(mapDispatchToProps) {
|
||
|
return typeof mapDispatchToProps === 'function' ? wrapMapToPropsFunc(mapDispatchToProps, 'mapDispatchToProps') : undefined;
|
||
|
}
|
||
|
export function whenMapDispatchToPropsIsMissing(mapDispatchToProps) {
|
||
|
return !mapDispatchToProps ? wrapMapToPropsConstant(function (dispatch) {
|
||
|
return {
|
||
|
dispatch: dispatch
|
||
|
};
|
||
|
}) : undefined;
|
||
|
}
|
||
|
export function whenMapDispatchToPropsIsObject(mapDispatchToProps) {
|
||
|
return mapDispatchToProps && typeof mapDispatchToProps === 'object' ? wrapMapToPropsConstant(function (dispatch) {
|
||
|
return bindActionCreators(mapDispatchToProps, dispatch);
|
||
|
}) : undefined;
|
||
|
}
|
||
|
export default [whenMapDispatchToPropsIsFunction, whenMapDispatchToPropsIsMissing, whenMapDispatchToPropsIsObject];
|