function slug(perfume) {
const { mainAccords, notes } = perfume;
if (notes == null) {
return `# Fragrance description:
N/A`;
}
let notesSlug = undefined;
if (Array.isArray(notes)) {
notesSlug = "## Notes (in order of votes)\n";
notesSlug += numberList(notes);
} else {
notesSlug = "## Notes\n";
if (notes.top != null) {
notesSlug += "### Top notes (in order of votes)\n";
notesSlug += numberList(notes.top);
}
if (notes.middle != null) {
notesSlug += "### Middle notes (in order of votes)\n";
notesSlug += numberList(notes.middle);
}
if (notes.base != null) {
notesSlug += "### Base notes (in order of votes)\n";
notesSlug += numberList(notes.base);
}
}
return `# Fragrance description
## Main accords (in order of prominence)
${numberList(mainAccords)}
${notesSlug}`.trim();
}