<commit_before>import cheerio from 'cheerio';
import moment from 'moment-timezone';

const originalTimeZone = 'Europe/Kiev';
const skiLiftDateFormat = 'DD.MM.YYYY HH:mm:ss';

export default function proceed(data) {

  if (data.error) {
    return {
      errors: Object.values(data.error),
      lifts: []
    };
  }

  const cardNumber = data.success;
  const $ = cheerio.load(data.html);
  const dataTables = $('table');
  const orginalPurchaseDate = dataTables.eq(0).find('#order_info_header_white:nth-child(1) > span').text();

  return {
    cardNumber: cardNumber,
    purchaseDate: getAdoptedDateString(orginalPurchaseDate),
    lifts: getLifts(dataTables.eq(1))
  };

  function getLifts($tableNode) {
    return $tableNode
      .find('tr')
      // skip first row,
      // because it is table header
      .slice(1)
      .map((index, element) => {
        var columns = $(element).find('td');

        return {
          skiLiftId: $(columns[0]).text(),
          date: getAdoptedDateString($(columns[1]).text()),
          initialLift: Number.parseInt($(columns[2]).text()),
          liftsLeft: Number.parseInt($(columns[3]).text())
        }
      })
      .toArray();<commit_msg>Use eq function to ge element by index.<commit_after>import cheerio from 'cheerio';
import moment from 'moment-timezone';

const originalTimeZone = 'Europe/Kiev';
const skiLiftDateFormat = 'DD.MM.YYYY HH:mm:ss';

export default function proceed(data) {

  if (data.error) {
    return {
      errors: Object.values(data.error),
      lifts: []
    };
  }

  const cardNumber = data.success;
  const $ = cheerio.load(data.html);
  const dataTables = $('table');
  const orginalPurchaseDate = dataTables.eq(0).find('#order_info_header_white:nth-child(1) > span').text();

  return {
    cardNumber: cardNumber,
    purchaseDate: getAdoptedDateString(orginalPurchaseDate),
    lifts: getLifts(dataTables.eq(1))
  };

  function getLifts($tableNode) {
    return $tableNode
      .find('tr')
      // skip first row,
      // because it is table header
      .slice(1)
      .map((index, element) => {
        var columns = $(element).find('td');

        return {
          skiLiftId: columns.eq(0).text(),
          date: getAdoptedDateString(columns.eq(1).text()),
          initialLift: Number.parseInt(columns.eq(2).text()),
          liftsLeft: Number.parseInt(columns.eq(3).text())
        }
      })
      .toArray();
{'fraction_non_alphanumeric': 0.15024834437086093, 'fraction_numerical': 0.006622516556291391, 'mean_word_length': 3.021630615640599, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3377855', 'n_tokens_mistral': 784, 'n_tokens_neox': 775, 'n_words': 152}