code: function dedupeAndSluggify (sluggify) {
    const existingHeadings = {}
    return (heading) => {
      const sluggifiedText = sluggify(heading)
      const existingCount = existingHeadings[sluggifiedText] || 0
      existingHeadings[sluggifiedText] = existingCount + 1
      return existingCount > 0 ? `${sluggifiedText}-${existingCount}` : sluggifiedText
    }
  }
docs: Takes an array and an sluggify function and returns a function that de-duplicates headings