Skip to content

Commit

Permalink
added salad menu and random meal module
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Aug 9, 2013
1 parent 5ecf9df commit 1c5eb79
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 2 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
73 changes: 73 additions & 0 deletions bin/menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
var menu = {
salads: {
base: ['Alface, Tomate, Cenoura',
'Massa Salteada',
'Arroz de Alho',
'Batatinhas cozidas salteadas']
, main: ['Frango cozido',
'Frango grelhado',
'Camarão',
'Delícias do Mar',
'Queijo fresco',
'Atum',
'Fiambre aos cubos']
, secondary: ['Milho',
'Cogumelos',
'Azeitonas',
'Ovo cozido',
'Ervilhas',
'Pimentos',
'Couve roxa ripada',
'Couve coração ripada',
'Pepino',
'Beterraba',
['Feijão Frade',
'Feijão Preto',
'Feijão Encarnado',
'Grão cozido'],
'Nozes',
'Amêndoas',
'Alface',
'Tomate',
'Cenoutra ralada',
'Maça',
'Pera',
'Abacaxi']
, drinks: ['Sumo natural de laranja',
'Sumo natural de maçã',
'Sumo natural de pera',
'Sumo natural de frutos vermelhos',
'Sumo natural de ananás',
'Sumo natural de manga',
'Sumo natural de maracujá']
}
}
module.exports = menu



//Still to come
// var dailyMenus = {
// monday: {

// },
// tuesday: {

// },
// wednesday: {

// },
// thursday: {

// }
// friday: {

// },
// allDaysSpecials: {

// }
// }

// var deserts = {

// }
32 changes: 32 additions & 0 deletions bin/randomMeal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
var menu = require('./menu.js')
, inspect = require('util').inspect

var randomMeal = function(){
var meal = {
base: function () {
return menu.salads.base[Math.floor((Math.random()*4))]
}()
, main: function () {
return menu.salads.main[Math.floor((Math.random()*7))]
}()
, secondary: function () {
var fourIngredients = []
var secondaries = menu.salads.secondary.slice(0)
for (var i = 0; i < 4; i++) {
var random = Math.floor(Math.random()*(19-i))
fourIngredients[i] = secondaries[random]
if (fourIngredients[i] instanceof Array) { // you only want one of the beans
fourIngredients[i] = secondaries[random][Math.floor((Math.random()*4))]
}
secondaries.splice(random, 1) // No repeated ingrediant for your salad :)
}
return fourIngredients
}()
, drinks: function () {
return menu.salads.drinks[Math.floor((Math.random()*7))]
}()
}
return meal
}

module.exports = randomMeal
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "marmita",
"version": "0.0.0",
"description": "A marmita-agnostic food exchange platform",
"description": "The first Marmita Agnostic Food Order as a Service platform",
"main": "index.js",
"bin": {
"marmita": "./bin/marmita.js"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
}
},
"license": "MIT"
}

0 comments on commit 1c5eb79

Please sign in to comment.