Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function geocodeP (p) {
if (qs[p]) {
const results = await geocode({
apiKey: process.env.MAPZEN_SEARCH_KEY,
boundary: geocoder.boundary,
focusPoint: geocoder.focusLatlng,
text: qs[p]
})
if (results.features.length > 0) {
return {
label: results.features[0].properties.label,
latlng: lonlat(results.features[0].geometry.coordinates)
}
}
}
}
return [await geocodeP('start'), await geocodeP('end')]