<commit_before>const calculateDistance = require('../displayUtils/calculateDistance');
const phoneNumberParser = require('../displayUtils/phoneNumberParser');
const getMessage = require('../getMessage');
const getOpeningTimes = require('./azOpeningTimesMapper');

function getContacts(asContacts) {
  const contacts = JSON.parse(asContacts);
  const contactDetails = {};

  contacts.forEach((c) => {
    if (c.OrganisationContactType === 'Primary') {
      const type = c.OrganisationContactMethodType;
      const lowerType = type ? type.toLowerCase() : '';
      switch (lowerType) {
        case 'fax':
        case 'telephone':
          contactDetails[lowerType] = phoneNumberParser(c.OrganisationContactValue);
          break;
        default:
          contactDetails[lowerType] = c.OrganisationContactValue;
      }
    }
  });
  return contactDetails;
}

module.exports = (org, origin, datetime) => {
  const contacts = getContacts(org.Contacts);
  const hasPhoneNumber = contacts && contacts.telephone;
  const openingTimes = getOpeningTimes(org.OpeningTimesV2);
  const {
    isOpen,
    openingTimesMessage,
    nextOpen,
  } = getMessage(openingTimes, hasPhoneNumber, datetime);
  const orgCoordinates = {
    latitude: org.Geocode.coordinates[1],
    longitude: org.Geocode.coordinates[0],
  };
  const mappedOrg = {
    /* eslint-disable sort-keys */
    identifier: org.NACSCode,
    name: org.OrganisationName,
    address: {
      line1: org.Address1 || '',
      line2: org.Address2 || '',
      line3: org.Address3 || '',
      city: org.City || '',
      county: org.County || '',
      postcode: org.Postcode || '',
    },
    contacts,
    openingTimes,
    distanceInMiles: calculateDistance(origin, orgCoordinates),
    isOpen,
    openingTimesMessage,
    nextOpen,
  };

  return mappedOrg;
};<commit_msg>:musical_note: add missing eslint enable directive<commit_after>const calculateDistance = require('../displayUtils/calculateDistance');
const phoneNumberParser = require('../displayUtils/phoneNumberParser');
const getMessage = require('../getMessage');
const getOpeningTimes = require('./azOpeningTimesMapper');

function getContacts(asContacts) {
  const contacts = JSON.parse(asContacts);
  const contactDetails = {};

  contacts.forEach((c) => {
    if (c.OrganisationContactType === 'Primary') {
      const type = c.OrganisationContactMethodType;
      const lowerType = type ? type.toLowerCase() : '';
      switch (lowerType) {
        case 'fax':
        case 'telephone':
          contactDetails[lowerType] = phoneNumberParser(c.OrganisationContactValue);
          break;
        default:
          contactDetails[lowerType] = c.OrganisationContactValue;
      }
    }
  });
  return contactDetails;
}

module.exports = (org, origin, datetime) => {
  const contacts = getContacts(org.Contacts);
  const hasPhoneNumber = contacts && contacts.telephone;
  const openingTimes = getOpeningTimes(org.OpeningTimesV2);
  const {
    isOpen,
    openingTimesMessage,
    nextOpen,
  } = getMessage(openingTimes, hasPhoneNumber, datetime);
  const orgCoordinates = {
    latitude: org.Geocode.coordinates[1],
    longitude: org.Geocode.coordinates[0],
  };
  const mappedOrg = {
    /* eslint-disable sort-keys */
    identifier: org.NACSCode,
    name: org.OrganisationName,
    address: {
      line1: org.Address1 || '',
      line2: org.Address2 || '',
      line3: org.Address3 || '',
      city: org.City || '',
      county: org.County || '',
      postcode: org.Postcode || '',
    },
    contacts,
    openingTimes,
    distanceInMiles: calculateDistance(origin, orgCoordinates),
    isOpen,
    openingTimesMessage,
    nextOpen,
    /* eslint-enable sort-keys */
  };

  return mappedOrg;
};
{'fraction_non_alphanumeric': 0.12844527696012845, 'fraction_numerical': 0.004816697886004816, 'mean_word_length': 3.377049180327869, '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': '3486567', 'n_tokens_mistral': 1099, 'n_tokens_neox': 1095, 'n_words': 211}