{"size": 644, "ext": "js", "max_stars_repo_path": "src/connect/mapStateToProps.js", "max_stars_repo_name": "chenyueban/rims", "max_stars_repo_stars_event_min_datetime": "2018-12-28T08:16:08.000Z", "max_stars_repo_stars_event_max_datetime": "2019-01-09T15:08:14.000Z", "max_issues_repo_path": "src/connect/mapStateToProps.js", "max_issues_repo_name": "chenyueban/rims", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/connect/mapStateToProps.js", "max_forks_repo_name": "chenyueban/rims", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 32.2, "max_line_length": 99, "alphanum_fraction": 0.7965838509}
import { wrapMapToPropsConstant, wrapMapToPropsFunc } from './wrapMapToProps';
import { checkMapStateToProps } from '../utils/check';

function whenMapStateToPropsIsFunction(mapStateToProps) {
  return wrapMapToPropsFunc(mapStateToProps, 'mapStateToProps');
}

function whenMapStateToPropsIsMissing() {
  return wrapMapToPropsConstant(() => ({}));
}

export default function (mapStateToProps) {
  checkMapStateToProps(mapStateToProps);

  if (typeof mapStateToProps === 'function') return whenMapStateToPropsIsFunction(mapStateToProps);
  if (!mapStateToProps) return whenMapStateToPropsIsMissing(mapStateToProps);

  return mapStateToProps;
}
