index.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  2. * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
  3. */
  4. var SUPPORTED_LOCALE = {
  5. tr: {
  6. regexp: /\u0130|\u0049|\u0049\u0307/g,
  7. map: {
  8. İ: "\u0069",
  9. I: "\u0131",
  10. İ: "\u0069",
  11. },
  12. },
  13. az: {
  14. regexp: /\u0130/g,
  15. map: {
  16. İ: "\u0069",
  17. I: "\u0131",
  18. İ: "\u0069",
  19. },
  20. },
  21. lt: {
  22. regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
  23. map: {
  24. I: "\u0069\u0307",
  25. J: "\u006A\u0307",
  26. Į: "\u012F\u0307",
  27. Ì: "\u0069\u0307\u0300",
  28. Í: "\u0069\u0307\u0301",
  29. Ĩ: "\u0069\u0307\u0303",
  30. },
  31. },
  32. };
  33. /**
  34. * Localized lower case.
  35. */
  36. export function localeLowerCase(str, locale) {
  37. var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
  38. if (lang)
  39. return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));
  40. return lowerCase(str);
  41. }
  42. /**
  43. * Lower case as a function.
  44. */
  45. export function lowerCase(str) {
  46. return str.toLowerCase();
  47. }
  48. //# sourceMappingURL=index.js.map