8 lines
304 B
JavaScript
8 lines
304 B
JavaScript
// Writes back the ingredient line from a list of names, skipping empty entries.
|
|
export function joinIngredientNames(names) {
|
|
if (!Array.isArray(names)) return ''
|
|
return names
|
|
.filter((name) => typeof name === 'string' && name.trim().length > 0)
|
|
.map((name) => name.trim())
|
|
.join(', ')
|
|
}
|