MICROBREWjs

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

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


// Drunken Microbrew Model/Collection or...

 const Brew = function( beerArgs ) {
 	this.brewName = beerArgs.brewName
 	this.brewType = beerArgs.brewType
 	this.abv = beerArgs.abv
 	this.brewInfo = () => `${brewName}: ${brewType}: ${abv}`
 }

 const CraftBrews = function() {
 	let distillery = []
 	return {
 		addCraft( craftInfo ) {
 			// Pouring a new Brew on the fly!
			// Never push, always spread!
 			distillery = [
				...distillery,
				new Brew( craftInfo )
			]
 		},
 		getCraftList( valid_id ) {
 			// Show some valid id...
 			return valid_id >= 21
 				? distillery
 				: `No 🍺🍺🍺🍺's 4 U!`
 		}
 	}
 }

 const crafts = new CraftBrews()

 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%'
 } )

 // Taste test!
 console.table( crafts.getCraftList( 21 ) )