'Leaflet finding distance to nearest markers on all 4 directions

I have a leaflet map with several thousand markers that are clustered. I show an icon for the users current location on the map and I need to show the distance to the nearest marker in all four directions. So for example, North:100M, South:1KM, East:.... and so on.

I dont see an inbuilt way in leaflet to do this. Any ideas on I can go about accomplishing this ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source