deburrLetter.js 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. /** Used to map latin-1 supplementary letters to basic latin letters. */
  2. var deburredLetters = {
  3. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  4. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  5. '\xc7': 'C', '\xe7': 'c',
  6. '\xd0': 'D', '\xf0': 'd',
  7. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  8. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  9. '\xcC': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  10. '\xeC': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  11. '\xd1': 'N', '\xf1': 'n',
  12. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  13. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  14. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  15. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  16. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  17. '\xc6': 'Ae', '\xe6': 'ae',
  18. '\xde': 'Th', '\xfe': 'th',
  19. '\xdf': 'ss'
  20. };
  21. /**
  22. * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters.
  23. *
  24. * @private
  25. * @param {string} letter The matched letter to deburr.
  26. * @returns {string} Returns the deburred letter.
  27. */
  28. function deburrLetter(letter) {
  29. return deburredLetters[letter];
  30. }
  31. module.exports = deburrLetter;