index.js 1.2 KB

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