index.js 1.3 KB

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