lib/recurrify.js
/**
   * Calculates the end of the overlap between any exception recurrence and the
   * specified start date. Returns undefined if there is no overlap.
   *
   * @param {String} dir: The direction to use, either 'next' or 'prev'
   * @param {Array} schedArr: The set of compiled recurrences to use
   * @param {Array} rangesArr: The set of cached start dates for the recurrences
   * @param {Date} startDate: The valid date for which the overlap will be found
   */
Calculates the end of the overlap between any exception recurrence and the
specified start date. Returns undefined if there is no overlap.

@param {String} dir: The direction to use, either 'next' or 'prev'
@param {Array} schedArr: The set of compiled recurrences to use
@param {Array} rangesArr: The set of cached start dates for the recurrences
@param {Date} startDate: The valid date for which the overlap will be found
Calculates the end of the overlap between any exception recurrence and the specified start date . Returns undefined if there is no overlap . @param { String } dir : The direction to use either ' next ' or ' prev ' @param { Array } schedArr : The set of compiled recurrences to use @param { Array } rangesArr : The set of cached start dates for the recurrences @param { Date } startDate : The valid date for which the overlap will be found
function calcRangeOverlap (dir, rangesArr, startDate) {
    var compare = compareFn(dir); var result
    for (var i = 0, len = rangesArr.length; i < len; i++) {
      var range = rangesArr[i]
      if (range && !compare(range[0], startDate) &&
        (!range[1] || compare(range[1], startDate))) {
        if (!result || compare(range[1], result)) {
          result = range[1]
        }
      }
    }
    return result
  }
function calcRangeOverlap ( dir , rangesArr , startDate ) { var compare = compareFn ( dir ) ; var result for ( var i = 0 , len = rangesArr . length ; i < len ; i ++ ) { var range = rangesArr [ i ] if ( range && ! compare ( range [ 0 ] , startDate ) && ( ! range [ 1 ] || compare ( range [ 1 ] , startDate ) ) ) { if ( ! result || compare ( range [ 1 ] , result ) ) { result = range [ 1 ] } } } return result }
Calculates the end of the overlap between any exception recurrence and the
 specified start date.
Calculates the end of the overlap between any exception recurrence and the specified start date .
// startDate is in the middle of an exception range