How to use the otherwise function from ramda
Find comprehensive JavaScript ramda.otherwise code examples handpicked from public code repositorys.
3 4 5 6 7 8 9 10 11 12
const useDefault = () => ({ firstName: 'Bob', lastName: 'Loblaw' }); //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);
0
1
0
555 556 557 558 559 560 561 562 563 564
* @sig (a -> b) -> (Promise e a) -> (Promise e b) * @sig (a -> (Promise e b)) -> (Promise e a) -> (Promise e b) * @param {Function} onSuccess The function to apply. Can return a value or a promise of a value. * @param {Promise} p * @return {Promise} The result of calling `p.then(onSuccess)` * @see R.otherwise * @example * * var makeQuery = (email) => ({ query: { email }}); *
0
0
2
+ 7 other calls in file
ramda.clone is the most popular function in ramda (30311 examples)