klleroy / RecipeBuddy

Search the Spoonacular API based to return Recipes and related ingredients.
https://jobu206.github.io/RecipeBuddy
MIT License
2 stars 7 forks source link

the API ingredient list #30

Closed GregoryLanter closed 5 years ago

GregoryLanter commented 5 years ago

The return from the API is in a text format and will need to be parsed. ex: 1 tablespoon olive oil from the looks of it we will need to

find the first space look to the left if this is a number then that is your amount remove that substring ie "1 " that leave us with

tablespoon olive oil so find the first space in this string and take everything to the left in this case "tablespoon" we will have to check this against a list of units if its a unit great take this off the string

leaving us with olive oil then anything left will be our ingredient

if the second substring is not a unit then we will keep everything as the ingredient so in the example of 6 large eggs

first pass we get amount as 6

second pass we get large but this is not a unit so everything left large egg is our ingredient

GregoryLanter commented 5 years ago

I checked in a version with a parsing function. Its Ok could use some fine tuning but it works in most cases still have testing to do

GregoryLanter commented 5 years ago

I'm going to hold off on a pull request until we see if we need any changes with a new api

GregoryLanter commented 5 years ago

This is no longer needed with the spoonacular API. i have removed it and updated the code in list-save.js