Skip to content

Commit

Permalink
added jsdoc example for maybe function
Browse files Browse the repository at this point in the history
  • Loading branch information
bjdixon committed Oct 1, 2015
1 parent 7bf7d6f commit ddf1375
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/xo.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,14 @@
* Takes a function and returns a function.
* The returned function will not be called if supplied with null
* or undefined arguments
*
* @example
* var sum = function(a, b) {
* return a + b;
* }
* var maybeSum = xo.maybe(sum);
* maybeSum(2, 3); // 5
* maybeSum(null, 3); // doesn't invoke sum
*
* @alias module:xo.maybe
* @param {Function} fn
Expand Down

0 comments on commit ddf1375

Please sign in to comment.