How to use the remove-accents function in remove-accents

To help you get started, we’ve selected a few remove-accents examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kentcdodds / match-sorter / src / index.js View on Github external
function prepareValueForComparison(value, {keepDiacritics}) {
  value = `${value}` // toString
  if (!keepDiacritics) {
    value = removeAccents(value)
  }
  return value
}
github miscord / miscord / src / messenger / getThreadName.ts View on Github external
let name
  try {
    name = thread.isGroup
      ? (thread.name || thread.id)
      : (
        (thread.nicknames ? thread.nicknames[thread.id] : null) || (await getSender(thread.id))!!.name
      )
  } catch (err) {
    name = thread.name || thread.id
  }
  log.debug('raw channel name', name)

  if (!clean) return name

  // clean name for the needs of discord channel naming
  const cleanname = removeAccents(name.toString()).trim().replace(/ /g, '-').replace(/\W-/g, '').replace(/(?![a-zA-Z0-9\-_])/g, '').toLowerCase()
  log.debug('clean thread name', cleanname)

  return cleanname
}

remove-accents

Converting the accented characters to their corresponding non-accented ASCII characters.

MIT
Latest version published 9 months ago

Package Health Score

74 / 100
Full package analysis

Popular remove-accents functions