refactor: simplify parse ingredients code
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import recipeSchema from "@lib/recipeSchema.ts";
|
||||
import { parseIngredient } from "@lib/parseIngredient.ts";
|
||||
import { parseIngredients } from "@lib/parseIngredient.ts";
|
||||
|
||||
export function parseJsonLdToRecipeSchema(jsonLdContent: string) {
|
||||
try {
|
||||
@ -20,8 +20,8 @@ export function parseJsonLdToRecipeSchema(jsonLdContent: string) {
|
||||
}
|
||||
|
||||
// Map and parse ingredients into the new schema
|
||||
const ingredients = (data.recipeIngredient || []).map(
|
||||
parseIngredient,
|
||||
const ingredients = parseIngredients(
|
||||
data?.recipeIngredient?.join("\n") || "",
|
||||
);
|
||||
|
||||
const instructions = Array.isArray(data.recipeInstructions)
|
||||
|
Reference in New Issue
Block a user