<commit_before>const IPromise = require('bluebird');
const callEventBriteAPI = require('minimal-request-promise');
const host = 'https://www.eventbriteapi.com/v3';
const debug = require('debug')('eb-checkin');

/**
 * Get attendees that are checked-in for an Eventbrite event
 * @param {string} accessToken
 * @param {number} eventID
 * @param {string} flag
 * @return {[string]}
 */

function getAttendeesForEvent(accessToken, eventID, flag) {
  return IPromise
          .try(() =>{
            const path = `/events/${eventID}/attendees/?token=${accessToken}`;
            debug(`Url is ${host + path}`);
            debug(`Flag is ${flag}`);
            if(arguments.length < 2 || (typeof accessToken === 'undefined') || (eventID === 'undefined')) {
              throw new Error('INCORRECT_ARGUMENTS');
            }
            if (flag && !(['noshow', 'checkedin', 'all'].indexOf(flag) > -1)) {
              throw new Error('INCORRECT_FLAG');
            }

            return callEventBriteAPI(host + path, Promise);
          })
          .then(body => {
            const result = JSON.parse(body);
            debug(`Message returned: ${result.attendees}`);
            return result.attendees;
          })
          .filter(attendee =>{
            if(!flag) {
              return attendee;
            }

            else if(flag === 'noshow') {
              return attendee.checked_in === false && attendee.cancelled === false && attendee.refunded === false;
            }
            return attendee.checked_in === true && attendee.cancelled === false && attendee.refunded === false;

          })
          .map(attendee => {
            debug(`The filtered attendee name is ${attendee.profile.name}`);
            return {
              'name': attendee.profile.name,
              'email': attendee.profile.email,
              'evenbriteID': attendee.id,
            };
          })
          .catch(err => {
            console.error('Error ', err);
            throw new Error(err);
          });

}

module.exports = {
  getAttendeesForEvent,
};<commit_msg>fix(index): The case of the flag input is not considered<commit_after>const IPromise = require('bluebird');
const callEventBriteAPI = require('minimal-request-promise');
const host = 'https://www.eventbriteapi.com/v3';
const debug = require('debug')('eb-checkin');

/**
 * Get attendees that are checked-in for an Eventbrite event
 * @param {string} accessToken
 * @param {number} eventID
 * @param {string} flag
 * @return {[string]}
 */

function getAttendeesForEvent(accessToken, eventID, flag) {
  return IPromise
          .try(() =>{
            const path = `/events/${eventID}/attendees/?token=${accessToken}`;
            debug(`Url is ${host + path}`);
            debug(`Flag is ${flag}`);
            if(arguments.length < 2 || (typeof accessToken === 'undefined') || (eventID === 'undefined')) {
              throw new Error('INCORRECT_ARGUMENTS');
            }
            if (flag && !(['noshow', 'checkedin', 'all'].indexOf(flag.toLowerCase()) > -1)) {
              throw new Error('INCORRECT_FLAG');
            }

            return callEventBriteAPI(host + path, Promise);
          })
          .then(body => {
            const result = JSON.parse(body);
            debug(`Message returned: ${result.attendees}`);
            return result.attendees;
          })
          .filter(attendee =>{
            if(!flag) {
              return attendee;
            }

            else if(flag.toLowerCase() === 'noshow') {
              return attendee.checked_in === false && attendee.cancelled === false && attendee.refunded === false;
            }
            return attendee.checked_in === true && attendee.cancelled === false && attendee.refunded === false;

          })
          .map(attendee => {
            debug(`The filtered attendee name is ${attendee.profile.name}`);
            return {
              'name': attendee.profile.name,
              'email': attendee.profile.email,
              'evenbriteID': attendee.id,
            };
          })
          .catch(err => {
            console.error('Error ', err);
            throw new Error(err);
          });

}

module.exports = {
  getAttendeesForEvent,
};
{'fraction_non_alphanumeric': 0.15081425536936513, 'fraction_numerical': 0.0014160962945480293, 'mean_word_length': 2.0314735336194563, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '563281', 'n_tokens_mistral': 1192, 'n_tokens_neox': 1191, 'n_words': 257}