quantum-markdown/lib/index.js
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
  }
}
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
  }
}
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 } }
Takes an array and an sluggify function and returns a function that de-duplicates headings
Takes an array and an sluggify function and returns a function that de - duplicates headings