2016-05-19 8 views
2

これらの太った矢印は、以下のコードで何をしていますか?彼らが2人でないかどうか分かりました!お互いに続く2つの太った矢印

export default function clientMiddleware(client) { 
    return ({dispatch, getState}) => { 
    // ******** starts here ********** 
    return next => action => { 
    // ******** ends here ********** 
     if (typeof action === 'function') { 
     return action(dispatch, getState); 
     } 

     const { promise, types, ...rest } = action; // eslint-disable-line no-redeclare 
     if (!promise) { 
     return next(action); 
     } 

     const [REQUEST, SUCCESS, FAILURE] = types; 
     next({...rest, type: REQUEST}); 

     const actionPromise = promise(client); 
     actionPromise.then(
     (result) => next({...rest, result, type: SUCCESS}), 
     (error) => next({...rest, error, type: FAILURE}) 
    ).catch((error)=> { 
     console.error('MIDDLEWARE ERROR:', error); 
     next({...rest, error, type: FAILURE}); 
     }); 

     return actionPromise; 
    }; 
    }; 
} 

このコードに相当するものは何ですか?

value => value2 => { 
    // some code 
} 

答えて

関連する問題