MICROBREWjs

A tipsy parody on a JS m** a microbrew framework... Hiccup!

**(no mvc/mvp/mv*/mvvm was hurt in the process)


// Simple Microbrew Model/Collection
// Brew model example
var Brew = function(dataset) {
	this.brewName = dataset.brewName;
	this.brewType = dataset.brewType;
	this.abv 	  = dataset.abv;
	this.brewInfo = function() {
	    return brewName + ': ' + brewType + ': ' + abv;
	};
};

// Distillery = collection... Hiccup!
var Crafts = function() {
	var distillery = [];
	return {
	    addCraft: function(dataset) {
	    	// Pourin'a new Brew on the fly!
	        distillery.push(new Brew(dataset));
	    },
	    getCraftList: function(id) {
	    	// Easter egg, show your id, ok bad joke...
	        return (id === undefined) ? distillery : distillery[id];
	    }
	};
};

var crafts = new Crafts();

crafts.addCraft({
	brewName: 'Mad Cat 180°',
	brewType: 'Double IPA',
	abv:      '18.00%'
});

crafts.addCraft({
	brewName: 'Hop Top Shizam',
	brewType: 'IPA',
	abv:      '12.50%'
});
crafts.addCraft({
	brewName: 'Cuckoo for Stout',
	brewType: 'Java Stout',
	abv:      '7.70%'
});
crafts.addCraft({
	brewName: 'Featherweight Wuss',
	brewType: 'Light Lager',
	abv:      '4.20%'
});

// Test'r out!
console.log(JSON.stringify(crafts.getCraftList()));