-
Notifications
You must be signed in to change notification settings - Fork 15
/
example.js
40 lines (37 loc) · 852 Bytes
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const nearbyCities = require('./')
const assert = require('assert')
const query = { latitude: 34.4362755, longitude: -119.705086 }
const cities = nearbyCities(query)
assert.strictEqual(cities[0].name, 'Mission Canyon')
assert.strictEqual(cities[1].name, 'Santa Barbara')
assert.strictEqual(cities[2].name, 'Montecito')
assert.strictEqual(cities[3].name, 'Summerland')
assert.strictEqual(cities[4].name, 'Goleta')
console.log(cities[0])
/*
{
name: "Mission Canyon",
country: "US",
altCountry: "",
muni: "",
muniSub: "",
featureClass: "P",
featureCode: "PPL",
adminCode: "CA",
population: 2381,
lat: 34.45083,
lon: -119.71291,
point: {
type: "Feature",
geometry: {
type: "Point",
coordinates: [
-119.71291,
34.45083
]
},
properties: {}
},
distance: 1.7708473508170872
}
*/