ππΊοΈππΊοΈππΊοΈππΊοΈππΊοΈπ
"CLOSE CUSTOMERS" TECH TEST
πΊοΈππΊοΈππΊοΈππΊοΈππΊοΈππΊοΈ
A barely-there, reusable program written in Node.js that:
- reads data from a .txt file,
- converts data to a JSON array,
- finds customers within a defined radius using the great-circle distance formula, and
- returns a new simplified output.txt file of "close customers", sorted by user_id.
HOW TO USE?
π In your teminal, run git clone https://github.com/dani-boo/close-customers.git
π Go to directory by running cd close-customers
π Run yarn
to install dependencies
π¨NB: You need node
to run this project, which you can download from here. If you don't know whether node is installed on your machine you can check with the command node -v
, which will print your current node version to the console.
π‘οΈ TESTING:
Run tests with yarn test
. See coverage report by running yarn test --coverage
π» RUN PROGRAM:
Write/overwrite the output.txt
file (in repo's public folder) by going to src folder (cd src
) and running writeFile function inside index.js:
node index.js
(this also logs the result to the console)
Sample input data:
Sample filtered and sorted data (customers who are close enough):
{"id": "4", "name": "Ian Kehoe"}
{"id": "5", "name": "Nora Dempsey"}
{"id": "6", "name": "Theresa Enright"}
{"id": "8", "name": "Eoin Ahearn"}
{"id": "11", "name": "Richard Finnegan"}
{"id": "12", "name": "Christina McArdle"}
{"id": "13", "name": "Olive Ahearn"}
{"id": "15", "name": "Michael Ahearn"}
{"id": "17", "name": "Patricia Cahill"}
{"id": "23", "name": "Eoin Gallagher"}
{"id": "24", "name": "Rose Enright"}
{"id": "26", "name": "Stephen McArdle"}
{"id": "29", "name": "Oliver Ahearn"}
{"id": "30", "name": "Nick Enright"}
{"id": "31", "name": "Alan Behan"}
{"id": "39", "name": "Lisa Ahearn"}