all files / src/ wrapMapStateToProps.js

100% Statements 20/20
100% Branches 10/10
100% Functions 5/5
100% Lines 9/9
6 statements, 1 function, 3 branches Ignored     
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 61×                   159×            
const wrapMapStateToProps = (mapStateToProps, getForm) => {
  if (mapStateToProps) {
    if (typeof mapStateToProps !== 'function') {
      throw new Error('mapStateToProps must be a function');
    }
    if (mapStateToProps.length > 1) {
      return (state, ownProps) => ({
        ...mapStateToProps(state, ownProps),
        form: getForm(state)
      });
    }
    return state => ({
      ...mapStateToProps(state),
      form: getForm(state)
    });
  }
  return state => ({
    form: getForm(state)
  });
};
 
export default wrapMapStateToProps;