File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change 11import arrayToObject from './lib/array-to-object' ;
22
33function normalizeNamespace ( fn ) {
4- return ( namespace , map , getterType , mutationType ) => {
5- /* eslint-disable no-param-reassign */
6- if ( typeof namespace !== `string` ) {
7- mutationType = getterType ;
8- getterType = map ;
9- map = namespace ;
10- namespace = `` ;
11- } else if ( namespace . charAt ( namespace . length - 1 ) !== `/` ) {
4+ return ( ...params ) => {
5+ // eslint-disable-next-line prefer-const
6+ let [ namespace , map , getterType , mutationType ] =
7+ typeof params [ 0 ] === `string` ? [ ...params ] : [ `` , ...params ] ;
8+
9+ if ( namespace . length && namespace . charAt ( namespace . length - 1 ) !== `/` ) {
1210 namespace += `/` ;
1311 }
1412
1513 getterType = `${ namespace } ${ getterType || `getField` } ` ;
1614 mutationType = `${ namespace } ${ mutationType || `updateField` } ` ;
17- /* eslint-enable */
1815
1916 return fn ( namespace , map , getterType , mutationType ) ;
2017 } ;
You can’t perform that action at this time.
0 commit comments