/PartyTime

Primary LanguageJavaScript

Intercom Party

Parties are afoot. Lucky customers within 100KM are invited

Install dependencies:

npm install

Run tests:

npm test

Run from the command line:

npm run party

Prints output as a JSON Array of customers within 100km, sorted by

[ 
  { userId: 4,
    customerName: 'Ian Kehoe',
    distance: 10.56693628886862,
    distanceString: '10.6 KM' },
  { userId: 5,
    customerName: 'Nora Dempsey',
    distance: 23.28732066309975,
    distanceString: '23.3 KM' },
  { userId: 6,
    customerName: 'Theresa Enright',
    distance: 24.085360019144137,
    distanceString: '24.1 KM' },
  { userId: 8,
    customerName: 'Eoin Ahearn',
    distance: 83.53253116785798,
    distanceString: '83.5 KM' },
  { userId: 11,
    customerName: 'Richard Finnegan',
    distance: 38.13756809820155,
    distanceString: '38.1 KM' },
  { userId: 12,
    customerName: 'Christina McArdle',
    distance: 41.768725500836844,
    distanceString: '41.8 KM' },
  { userId: 13,
    customerName: 'Olive Ahearn',
    distance: 62.23170226292846,
    distanceString: '62.2 KM' },
  { userId: 15,
    customerName: 'Michael Ahearn',
    distance: 43.72248745925148,
    distanceString: '43.7 KM' },
  { userId: 17,
    customerName: 'Patricia Cahill',
    distance: 96.07859923633491,
    distanceString: '96.1 KM' },
  { userId: 23,
    customerName: 'Eoin Gallagher',
    distance: 82.69492611640008,
    distanceString: '82.7 KM' },
  { userId: 24,
    customerName: 'Rose Enright',
    distance: 89.03103382223587,
    distanceString: '89.0 KM' },
  { userId: 26,
    customerName: 'Stephen McArdle',
    distance: 98.87459926458502,
    distanceString: '98.9 KM' },
  { userId: 29,
    customerName: 'Oliver Ahearn',
    distance: 72.20178549704256,
    distanceString: '72.2 KM' },
  { userId: 30,
    customerName: 'Nick Enright',
    distance: 82.64284999110247,
    distanceString: '82.6 KM' },
  { userId: 31,
    customerName: 'Alan Behan',
    distance: 44.29082235506643,
    distanceString: '44.3 KM' },
  { userId: 39,
    customerName: 'Lisa Ahearn',
    distance: 38.35801477480616,
    distanceString: '38.4 KM' }
]