<commit_before>(function() {
  'use strict';

  var Eventfeed, root;

  Eventfeed = (function() {

    function Eventfeed(params) {
      var option, value;

      // default options
      this.options = {
        target: 'eventfeed',
        orderBy: 'none',
        pastEvents: false,
        abbreviate: false
      };

      // overrides default options if an object is passed
      if (typeof params === 'object') {
        for (option in params) {
          value = params[option];
          this.options[option] = value;
        }
      }
    }

    // run the feed
    Eventfeed.prototype.run = function(url) {

      // make sure the calendarid is set
      if (typeof this.options.calendarId !== 'string') {
        throw new Error("Missing calendarId.");
      }

      console.log('Running feed...');

      this._buildUrl();
      this._fetchData();
      this._parseData();

      // return true if all goes well
      return true;
    };

    // url builder for the request
    Eventfeed.prototype._buildUrl = function() {
      var base, fields, key, final, now;
      base = "https://www.googleapis.com/calendar/v3/calendars/";
      fields = "&fields=description,items(created,description,end,hangoutLink,htmlLink,id,location,start,status,summary,updated)";
      key = <KEY>";
      final = "" + base + this.options.calendarId + "/events?";
      now = (new Date()).toISOString();
      // max results
      if (this.options.maxResults != null) {
        if (typeof this.options.maxResults !== 'number') {
          throw new Error("The maxResults option must be a number.");
        }
        final += "&maxResults=" + this.options.maxResults;
      }
      // single events
      if (this.options.singleEvents != null) {
        if (typeof this.options.singleEvents !== 'boolean') {
          throw new Error("The singleEvents option must be a boolean.");
        }
        final += "&singleEvents=" + this.options.singleEvents;
      }
      // show deleted
      if (this.options.showDeleted != null) {
        if (typeof this.options.showDeleted !== 'boolean') {
          throw new Error("The showDeleted option must be a boolean.");
        }
        final += "&showDeleted=" + this.options.showDeleted;
      }
      // past events
      if (typeof this.options.pastEvents !== 'boolean') {
        throw new Error("The pastEvents option must be a boolean.");
      }
      if (this.options.pastEvents === false) {
        final += '&timeMin=' + now;
      }
      // order by
      switch (this.options.orderBy) {
        case "none":
          break;
        case "startTime":
          if(this.options.singleEvents !== true) {
            throw new Error("The singleEvents option must be true to order by startTime.");
          }
          final += "&orderBy=startTime";
          break;
        case "updated":
          final += "&orderBy=updated";
          break;
        default:
          throw new Error("Invalid option for orderBy: '" + this.options.orderBy + "'.");
      }
      final += key;
      console.log('Building url...');
      console.log('url: ' + final);
    };

    // data fetcher
    Eventfeed.prototype._fetchData = function(url) {
      url = url || '';
      console.log('Fetching data...');
      console.log('data: undefined');
    };

    // data parser (must be a JSON object)
    Eventfeed.prototype._parseData = function(data) {
      data = data || 'empty';
      console.log('Parsing data...');
      console.log('no data to parse.');
    };

    // helper function for parsing month
    Eventfeed.prototype._thisMonth = function(d) {
      var dateTime = new Date(d),
        months = ['January','February','March','April','May','June','July','August','September','October','November','December'],
        monthsAbbr = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
      if (this.options.abbreviate === true) {
        return monthsAbbr[dateTime.getMonth()];
      } else {
        return months[dateTime.getMonth()];
      }
    }

    // helper function for date plus oridinal
    Eventfeed.prototype._thisDay = function(d) {
      var dateTime = new Date(d);
      return dateTime.getDate() + _thisOrd(dateTime.getDate());
    }

    // helper function for time (HH:MM)
    Eventfeed.prototype._thisTime = function(d) {
      var dateTime = new Date(d);
      return dateTime.timeNow();
    }

    // helper function for date ordinals
    Eventfeed.prototype._thisOrd = function(d) {
      if (d > 3 && d < 21) return 'th';
      switch (d % 10) {<commit_msg>Private Helper Functions<commit_after>(function() {
  'use strict';

  var Eventfeed, root;

  Eventfeed = (function() {

    function Eventfeed(params) {
      var option, value;

      // default options
      this.options = {
        target: 'eventfeed',
        orderBy: 'none',
        pastEvents: false,
        abbreviate: false
      };

      // overrides default options if an object is passed
      if (typeof params === 'object') {
        for (option in params) {
          value = params[option];
          this.options[option] = value;
        }
      }
    }

    // run the feed
    Eventfeed.prototype.run = function(url) {

      // make sure the calendarid is set
      if (typeof this.options.calendarId !== 'string') {
        throw new Error("Missing calendarId.");
      }

      console.log('Running feed...');

      this._buildUrl();
      this._fetchData();
      this._parseData();

      // return true if all goes well
      return true;
    };

    // url builder for the request
    Eventfeed.prototype._buildUrl = function() {
      var base, fields, key, final, now;
      base = "https://www.googleapis.com/calendar/v3/calendars/";
      fields = "&fields=description,items(created,description,end,hangoutLink,htmlLink,id,location,start,status,summary,updated)";
      key = "&key=<KEY>";
      final = "" + base + this.options.calendarId + "/events?";
      now = (new Date()).toISOString();
      // max results
      if (this.options.maxResults != null) {
        if (typeof this.options.maxResults !== 'number') {
          throw new Error("The maxResults option must be a number.");
        }
        final += "&maxResults=" + this.options.maxResults;
      }
      // single events
      if (this.options.singleEvents != null) {
        if (typeof this.options.singleEvents !== 'boolean') {
          throw new Error("The singleEvents option must be a boolean.");
        }
        final += "&singleEvents=" + this.options.singleEvents;
      }
      // show deleted
      if (this.options.showDeleted != null) {
        if (typeof this.options.showDeleted !== 'boolean') {
          throw new Error("The showDeleted option must be a boolean.");
        }
        final += "&showDeleted=" + this.options.showDeleted;
      }
      // past events
      if (typeof this.options.pastEvents !== 'boolean') {
        throw new Error("The pastEvents option must be a boolean.");
      }
      if (this.options.pastEvents === false) {
        final += '&timeMin=' + now;
      }
      // order by
      switch (this.options.orderBy) {
        case "none":
          break;
        case "startTime":
          if(this.options.singleEvents !== true) {
            throw new Error("The singleEvents option must be true to order by startTime.");
          }
          final += "&orderBy=startTime";
          break;
        case "updated":
          final += "&orderBy=updated";
          break;
        default:
          throw new Error("Invalid option for orderBy: '" + this.options.orderBy + "'.");
      }
      final += key;
      console.log('Building url...');
      console.log('url: ' + final);
    };

    // data fetcher
    Eventfeed.prototype._fetchData = function(url) {
      url = url || '';
      console.log('Fetching data...');
      console.log('data: undefined');
    };

    // data parser (must be a JSON object)
    Eventfeed.prototype._parseData = function(data) {
      data = data || 'empty';
      console.log('Parsing data...');
      console.log('no data to parse.');
    };

    // helper function for parsing month
    function _thisMonth(d, a) {
      var dateTime = new Date(d),
          months = ['January','February','March','April','May','June','July','August','September','October','November','December'],
          monthsAbbr = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
      if (a === true) {
        return monthsAbbr[dateTime.getMonth()];
      } else {
        return months[dateTime.getMonth()];
      }
    }

    // helper function for date plus oridinal
    function _thisDay(d) {
      var dateTime = new Date(d);
      return dateTime.getDate() + _thisOrd(dateTime.getDate());
    }

    // helper function for time (HH:MM)
    function _thisTime(d) {
      var dateTime = new Date(d);
      return dateTime.timeNow();
    }

    // helper function for date ordinals
    function _thisOrd(d) {
      if (d > 3 && d < 21) return 'th';
      switch (d % 10) {
{'fraction_non_alphanumeric': 0.146843853820598, 'fraction_numerical': 0.00132890365448505, 'mean_word_length': 2.2047551454932575, 'pattern_counts': {'":': 6, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3552516', 'n_tokens_mistral': 2610, 'n_tokens_neox': 2533, 'n_words': 657}