1.1.2 • Published 4 years ago
nearest-loc-finder v1.1.2
/ This code will require the geo npm module then call getNearestCustomers Method from library. /
npm install nearest-loc-finder
const GeoLocation = require("nearest-loc-finder"); //Import Geo Module
let distance = 100; //In KM
let customers = GeoLocation.getNearestRecords(28.5355, 77.3910, distance, "KM") //With 100 KM to Dublin
let sortedCustomers = GeoLocation.sortRecords(customers, "asc"); // Sorting of customers
console.log("list of customers in", distance, "KM: ", sortedCustomers);