var beer = require('./_data.json');
var beerSuggestions = function() {};
beerSuggestions.prototype.getLocalBeers = function (state, callback) {
var results = beer.filter(function(x) {
return (x.state === state);
});
callback(results);
}
beerSuggestions.prototype.getRandomLocalBeer = function (state, callback) {
var results = beer.filter(function(x) {
return (x.state === state);
});
var item = results[Math.floor(Math.random()*results.length)];
callback(item);
}
beerSuggestions.prototype.styleExists = function (style, callback) {
var found = false;
for(var i = 0; i < beer.length; i++) {
if (beer[i].style == style) {
found = true;
break;
}
}
callback(found);
}
module.exports = new beerSuggestions();