Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let getGeolocationResults = function(items, index, record, cb) {
console.log(items)
if (index < items.length) {
console.log("processing: ", items[index]);
let poi_point = {latitude: items[index].latitude, longitude: items[index].longitude};
if(geolib.isPointWithinRadius(poi_point,{latitude: record.latitude, longitude: record.longitude},items[index].radius)){
console.log('point is in circle for ' + items[index].poi);
processAd(record, items[index], function(err, data) {
if (err) {
console.log("error processing ad");
console.log(err);
return cb(err, null);
} else {
index++;
getGeolocationResults(items, index, record, cb);
}
});
} else {
index++;
getGeolocationResults(items, index, record, cb);
}
incident =>
isPointWithinRadius(
incident.coordinates,
user.location.coordinates!,
filter.distance! * 1000
)
);