lib/calendar.js
function(count, includeWeekends) {
    initialize();

    count = count || 3;
    includeWeekends = includeWeekends || false;

    var self = this;
    var holidays = [];

    if (count > self.MAX_HOLIDAYS) {
      throw Error('Cannot request more than {MAX_HOLIDAYS} holidays at once.'.replace('{MAX HOLIDAYS}', self.MAX_HOLIDAYS));
    }

    /**
     * Collects holidays.
     */
    function collectHolidays() {
      if (typeof self.year.holidays[self.m] !== 'undefined' && typeof self.year.holidays[self.m] !== 'undefined') {
        self.year.holidays[self.m].forEach(function(holiday) {
          if (holidays.length < count && holiday.day >= self.d) {
            holidays.push(holiday);
          }
        });
      }
    }

    while (holidays.length < count) {
      if (!includeWeekends) {
        self.year.discardWeekends();
      }

      collectHolidays();

      if (holidays.length < count) {
        nextMonth();
      }
    }

    return holidays;
  }
function(count, includeWeekends) {
    initialize();

    count = count || 3;
    includeWeekends = includeWeekends || false;

    var self = this;
    var holidays = [];

    if (count > self.MAX_HOLIDAYS) {
      throw Error('Cannot request more than {MAX_HOLIDAYS} holidays at once.'.replace('{MAX HOLIDAYS}', self.MAX_HOLIDAYS));
    }

    /**
     * Collects holidays.
     */
    function collectHolidays() {
      if (typeof self.year.holidays[self.m] !== 'undefined' && typeof self.year.holidays[self.m] !== 'undefined') {
        self.year.holidays[self.m].forEach(function(holiday) {
          if (holidays.length < count && holiday.day >= self.d) {
            holidays.push(holiday);
          }
        });
      }
    }

    while (holidays.length < count) {
      if (!includeWeekends) {
        self.year.discardWeekends();
      }

      collectHolidays();

      if (holidays.length < count) {
        nextMonth();
      }
    }

    return holidays;
  }
function ( count , includeWeekends ) { initialize ( ) ; count = count || 3 ; includeWeekends = includeWeekends || false ; var self = this ; var holidays = [ ] ; if ( count > self . MAX_HOLIDAYS ) { throw Error ( 'Cannot request more than {MAX_HOLIDAYS} holidays at once.' . replace ( '{MAX HOLIDAYS}' , self . MAX_HOLIDAYS ) ) ; } /**
     * Collects holidays.
     */ function collectHolidays ( ) { if ( typeof self . year . holidays [ self . m ] !== 'undefined' && typeof self . year . holidays [ self . m ] !== 'undefined' ) { self . year . holidays [ self . m ] . forEach ( function ( holiday ) { if ( holidays . length < count && holiday . day >= self . d ) { holidays . push ( holiday ) ; } } ) ; } } while ( holidays . length < count ) { if ( ! includeWeekends ) { self . year . discardWeekends ( ) ; } collectHolidays ( ) ; if ( holidays . length < count ) { nextMonth ( ) ; } } return holidays ; }
Returns the next holidays.
@param {number} [count] number of holidays to list (default: 3)
@param {boolean} [includeWeekends] include holidays falling on a weekend (default: false)
@return {Array}
Returns the next holidays .