UNPKG
@zenlocator/geo
Version:
latest (0.1.6)
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
geo lib
github.com/zenlocator/geo
zenlocator/geo
@zenlocator/geo
/
lib
/
getClosest.js
14 lines
(8 loc)
•
196 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
export
default
function
(
center, coords = []
) {
let
ret;
const
orderedCoords =
this
.
orderByDistance
(center, coords);
if
(orderedCoords.
length
) { ret = orderedCoords[
0
]; }
return
ret; }