1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 1× 61× 6× 4× 2× 1× 1× 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; |