How to use the andThen function from ramda

Find comprehensive JavaScript ramda.andThen code examples handpicked from public code repositorys.

61
62
63
64
65
66
67
68
69
70
71
  });


const lintReportAndExit = R.pipe(
  R.map(lintComponent),
  (p) => Promise.all(p),
  R.andThen(
    R.pipe(
      R.map(logReport),
      R.reject(R.equals(false)),
      R.unless(R.isEmpty, () => process.exit(1)),
fork icon0
star icon2
watch icon0

4
5
6
7
8
9
10
11
12


//recoverFromFailure :: String -> Promise ({ firstName, lastName })
const recoverFromFailure = R.pipe(
    failedFetch,  // solve -> to andThen
    R.otherwise(useDefault),
    R.andThen(R.pick(['firstName', 'lastName'])),
);
recoverFromFailure(12345).then(console.log);
fork icon0
star icon1
watch icon0

5
6
7
8
9
10
11
12
13
14
15


//getMemberName :: String -> Promise ({ firstName, lastName })
const getMemberName = R.pipe(
  makeQuery,
  fetchMember,
  R.andThen(R.pick(['firstName', 'lastName']))
);


getMemberName('bob@gmail.com').then(console.log);
fork icon0
star icon1
watch icon0

564
565
566
567
568
569
570
571
572
*
*      //getMemberName :: String -> Promise ({firstName, lastName})
*      var getMemberName = R.pipe(
*        makeQuery,
*        fetchMember,
*        R.andThen(R.pick(['firstName', 'lastName']))
*      );
*/

fork icon0
star icon0
watch icon2

+ 3 other calls in file

Other functions in ramda

Sorted by popularity

function icon

ramda.clone is the most popular function in ramda (30311 examples)