nd-cust-geo
Version:
We have some customer records in a text file (customers.txt) -- one customer per line, JSON lines formatted. We want to invite any customer within 100km of Dublin for some food and drinks on us. Write a program that will read the full list of customers an
41 lines (30 loc) • 1.09 kB
Markdown
The nd-cust-geo Node library provides convenient access to the user list from given source file within passed range.
Install the package with:
```
npm install nd-cust-geo --save
```
```javascript
var geolib = require('nd-cust-geo');
var originlat='53.339428';
var originlong = '-6.257664';
var filename = 'customers.txt';
var range = 100;
var sortBy ='user_id';
geolib.setCustParams(originlat,originlong,filename,range,sortBy);
geolib.getcustomers().then(result=>{
console.log(result);
});
```
```javascript
{"latitude": "52.986375", "user_id": 12, "name": "Christina McArdle", "longitude": "-6.043701"}
{"latitude": "51.92893", "user_id": 1, "name": "Alice Cahill", "longitude": "-10.27699"}
{"latitude": "51.8856167", "user_id": 2, "name": "Ian McArdle", "longitude": "-10.4240951"}
{"latitude": "52.3191841", "user_id": 3, "name": "Jack Enright", "longitude": "-8.5072391"}
```
---
You can raise an issue in this repo or mail me at pankaj.jingle@gmail.com