1.0.0 • Published 11 years ago
nearest-coffee v1.0.0
nearest-coffee
Client-side Google Places search for coffee shops near the given Lat/Lng.
var coffee = require('nearest-coffee')
coffee({
location: [40.758895, -73.985131],
radius: 1000
}, function(err, data) {
if (err)
throw err
var places = data.map(function(d) {
return d.name
})
console.log(places)
})Assumes google is already a global, e.g. via:
<script src="https://maps.googleapis.com/maps/api/js?libraries=places"></script>PRs for Node version welcome.
Usage
coffee(opt[, callback])
If opt is an array, it's assumed to be a simple [lat, lng]. Otherwise you can pass any options for the Places API, including:
radiusin meters, defaults to 500. max is 50,000 mlocationa Google Map, LatLng object, or simple[lat, lng]array`keyworda term to matchnamea name to matchrankBycan be'prominence'(default) or'distance'(will ignoreradius)typeswhich defaults to['cafe']elementthe Map, or a DOM element that receives attributions (required per Terms of Service)
License
MIT, see LICENSE.md for details.
1.0.0
11 years ago
