Skip to content

Commit

Permalink
add an example which covers error and value (#2806)
Browse files Browse the repository at this point in the history
* add an example which covers error and value

* fix singlequote
  • Loading branch information
Alireza Bonab authored and CrossEye committed Apr 10, 2019
1 parent 271b044 commit ca1e2b5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions source/tryCatch.js
Expand Up @@ -23,6 +23,7 @@ import _curry2 from './internal/_curry2';
* R.tryCatch(R.prop('x'), R.F)({x: true}); //=> true
* R.tryCatch(() => { throw 'foo'}, R.always('catched'))('bar') // => 'catched'
* R.tryCatch(R.times(R.identity), R.always([]))('s') // => []
* R.tryCatch(() => { throw 'this is not a valid value'}, (err, value)=>({error : err, value }))('bar') // => {'error': 'this is not a valid value', 'value': 'bar'}
*/
var tryCatch = _curry2(function _tryCatch(tryer, catcher) {
return _arity(tryer.length, function() {
Expand Down

0 comments on commit ca1e2b5

Please sign in to comment.