Skip to content

Instantly share code, notes, and snippets.

@stuff
Created March 7, 2023 10:43
Show Gist options
  • Save stuff/646a25e8c777c35293d33a3d6a2b9f44 to your computer and use it in GitHub Desktop.
Save stuff/646a25e8c777c35293d33a3d6a2b9f44 to your computer and use it in GitHub Desktop.
pseudo code recherche
import { getIngredients } from './../../data/recipesData.js';
const mainSearch = 'gateau';
const selectedAppliance = 'casserole';
const selectedUstensils = ['couteau', 'casserole'];
const selectedIngredients = ['pomme', 'chocolat'];
const recipies = {
/* */
};
function filterRecipes(query, queryOpptions) {
}
filterRecipes('');
filterRecipes('', { appliance: 'casserole' });
filterRecipes('', {
appliance: 'casserole',
ingredients: ['pomme', 'chocolat'],
});
function filterIngredients(query) {
}
filterIngredients(''); //
filterIngredients('coc'); //
onclick(ingredient) {
selectedIngredients.push(ingredient);
buildMainResults()
buildIngredients();
}
function buildMainResults(){
// const mainSearch = 'gateau';
// const selectedAppliance = 'casserole';
// const selectedUstensils = ['couteau', 'casserole'];
// const selectedIngredients = ['pomme', 'chocolat'];
const results = filterRecipes(mainSearch, { ingredients: selectedIngredients});
}
// expect(filterIngredients('coc')).toEqual(['Coco']);
// expect(filterIngredients('c')).toEqual(['Coco', 'Chocolat', 'Creme']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment