This this data:
const cocktail = [
{
"idDrink":"13070",
"strDrink":"Fahrenheit 5000",
"strGlass":"Shot glass",
"strInstructions":"Cover bottom of shot gla",
"strIngredient1":"Firewater",
"strIngredient2":"Absolut Peppar",
"strIngredient3":"Tabasco sauce",
"strIngredient4":null,
"strMeasure1":"1/2 oz ",
"strMeasure2":"1/2 oz ",
"strMeasure3":"1 dash ",
"strMeasure4":null
}
]
it's my hope to return an array of objects that populate the non-null
values of each strMeasure[n] and strIngredient[n]:
[
{
strMeasure1: value,
strIngredient1: value
},
{
strMeasure2: value,
strIngredient2: value
},
…
]
from cocktail
array above, the ideal output would be:
[
{
measure: '1/2 oz',
name: 'Firewater'
},
{
measure: '1/2 oz',
name: 'Absolut Peppar'
},
{
measure: '1 dash',
name: 'Tobasco sauce'
},
]