11import shallowEqual from '../utils/shallowEqual' ;
22import wrapActionCreators from '../utils/wrapActionCreators' ;
33import invariant from 'invariant' ;
4- import _ from 'lodash' ;
4+
5+ import isPlainObject from 'lodash.isplainobject' ;
6+ import isFunction from 'lodash.isfunction' ;
7+ import isObject from 'lodash.isobject' ;
8+ import assign from 'lodash.assign' ;
59
610const defaultMapStateToTarget = ( ) => ( { } ) ;
711const defaultMapDispatchToTarget = dispatch => ( { dispatch} ) ;
@@ -11,17 +15,17 @@ export default function Connector(store) {
1115
1216 const finalMapStateToTarget = mapStateToTarget || defaultMapStateToTarget ;
1317
14- const finalMapDispatchToTarget = _ . isPlainObject ( mapDispatchToTarget ) ?
18+ const finalMapDispatchToTarget = isPlainObject ( mapDispatchToTarget ) ?
1519 wrapActionCreators ( mapDispatchToTarget ) :
1620 mapDispatchToTarget || defaultMapDispatchToTarget ;
1721
1822 invariant (
19- _ . isFunction ( finalMapStateToTarget ) ,
23+ isFunction ( finalMapStateToTarget ) ,
2024 'mapStateToTarget must be a Function. Instead received $s.' , finalMapStateToTarget
2125 ) ;
2226
2327 invariant (
24- _ . isPlainObject ( finalMapDispatchToTarget ) || _ . isFunction ( finalMapDispatchToTarget ) ,
28+ isPlainObject ( finalMapDispatchToTarget ) || isFunction ( finalMapDispatchToTarget ) ,
2529 'mapDispatchToTarget must be a plain Object or a Function. Instead received $s.' , finalMapDispatchToTarget
2630 ) ;
2731
@@ -32,7 +36,7 @@ export default function Connector(store) {
3236 return ( target ) => {
3337
3438 invariant (
35- _ . isFunction ( target ) || _ . isObject ( target ) ,
39+ isFunction ( target ) || isObject ( target ) ,
3640 'The target parameter passed to connect must be a Function or a object.'
3741 ) ;
3842
@@ -53,18 +57,18 @@ export default function Connector(store) {
5357}
5458
5559function updateTarget ( target , StateSlice , dispatch ) {
56- if ( _ . isFunction ( target ) ) {
60+ if ( isFunction ( target ) ) {
5761 target ( StateSlice , dispatch ) ;
5862 } else {
59- _ . assign ( target , StateSlice , dispatch ) ;
63+ assign ( target , StateSlice , dispatch ) ;
6064 }
6165}
6266
6367function getStateSlice ( state , mapStateToScope ) {
6468 const slice = mapStateToScope ( state ) ;
6569
6670 invariant (
67- _ . isPlainObject ( slice ) ,
71+ isPlainObject ( slice ) ,
6872 '`mapStateToScope` must return an object. Instead received %s.' ,
6973 slice
7074 ) ;
0 commit comments