alpha.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.commaDecimal = exports.dotDecimal = exports.farsiLocales = exports.arabicLocales = exports.englishLocales = exports.decimal = exports.alphanumeric = exports.alpha = void 0;
  6. var alpha = {
  7. 'en-US': /^[A-Z]+$/i,
  8. 'az-AZ': /^[A-VXYZÇƏĞİıÖŞÜ]+$/i,
  9. 'bg-BG': /^[А-Я]+$/i,
  10. 'cs-CZ': /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
  11. 'da-DK': /^[A-ZÆØÅ]+$/i,
  12. 'de-DE': /^[A-ZÄÖÜß]+$/i,
  13. 'el-GR': /^[Α-ώ]+$/i,
  14. 'es-ES': /^[A-ZÁÉÍÑÓÚÜ]+$/i,
  15. 'fa-IR': /^[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی]+$/i,
  16. 'fi-FI': /^[A-ZÅÄÖ]+$/i,
  17. 'fr-FR': /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,
  18. 'it-IT': /^[A-ZÀÉÈÌÎÓÒÙ]+$/i,
  19. 'nb-NO': /^[A-ZÆØÅ]+$/i,
  20. 'nl-NL': /^[A-ZÁÉËÏÓÖÜÚ]+$/i,
  21. 'nn-NO': /^[A-ZÆØÅ]+$/i,
  22. 'hu-HU': /^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i,
  23. 'pl-PL': /^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
  24. 'pt-PT': /^[A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,
  25. 'ru-RU': /^[А-ЯЁ]+$/i,
  26. 'sl-SI': /^[A-ZČĆĐŠŽ]+$/i,
  27. 'sk-SK': /^[A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,
  28. 'sr-RS@latin': /^[A-ZČĆŽŠĐ]+$/i,
  29. 'sr-RS': /^[А-ЯЂЈЉЊЋЏ]+$/i,
  30. 'sv-SE': /^[A-ZÅÄÖ]+$/i,
  31. 'th-TH': /^[ก-๐\s]+$/i,
  32. 'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i,
  33. 'uk-UA': /^[А-ЩЬЮЯЄIЇҐі]+$/i,
  34. 'vi-VN': /^[A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,
  35. 'ku-IQ': /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
  36. ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
  37. he: /^[א-ת]+$/,
  38. fa: /^['آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی']+$/i,
  39. 'hi-IN': /^[\u0900-\u0961]+[\u0972-\u097F]*$/i
  40. };
  41. exports.alpha = alpha;
  42. var alphanumeric = {
  43. 'en-US': /^[0-9A-Z]+$/i,
  44. 'az-AZ': /^[0-9A-VXYZÇƏĞİıÖŞÜ]+$/i,
  45. 'bg-BG': /^[0-9А-Я]+$/i,
  46. 'cs-CZ': /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
  47. 'da-DK': /^[0-9A-ZÆØÅ]+$/i,
  48. 'de-DE': /^[0-9A-ZÄÖÜß]+$/i,
  49. 'el-GR': /^[0-9Α-ω]+$/i,
  50. 'es-ES': /^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,
  51. 'fi-FI': /^[0-9A-ZÅÄÖ]+$/i,
  52. 'fr-FR': /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,
  53. 'it-IT': /^[0-9A-ZÀÉÈÌÎÓÒÙ]+$/i,
  54. 'hu-HU': /^[0-9A-ZÁÉÍÓÖŐÚÜŰ]+$/i,
  55. 'nb-NO': /^[0-9A-ZÆØÅ]+$/i,
  56. 'nl-NL': /^[0-9A-ZÁÉËÏÓÖÜÚ]+$/i,
  57. 'nn-NO': /^[0-9A-ZÆØÅ]+$/i,
  58. 'pl-PL': /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
  59. 'pt-PT': /^[0-9A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,
  60. 'ru-RU': /^[0-9А-ЯЁ]+$/i,
  61. 'sl-SI': /^[0-9A-ZČĆĐŠŽ]+$/i,
  62. 'sk-SK': /^[0-9A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,
  63. 'sr-RS@latin': /^[0-9A-ZČĆŽŠĐ]+$/i,
  64. 'sr-RS': /^[0-9А-ЯЂЈЉЊЋЏ]+$/i,
  65. 'sv-SE': /^[0-9A-ZÅÄÖ]+$/i,
  66. 'th-TH': /^[ก-๙\s]+$/i,
  67. 'tr-TR': /^[0-9A-ZÇĞİıÖŞÜ]+$/i,
  68. 'uk-UA': /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i,
  69. 'ku-IQ': /^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
  70. 'vi-VN': /^[0-9A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,
  71. ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
  72. he: /^[0-9א-ת]+$/,
  73. fa: /^['0-9آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی۱۲۳۴۵۶۷۸۹۰']+$/i,
  74. 'hi-IN': /^[\u0900-\u0963]+[\u0966-\u097F]*$/i
  75. };
  76. exports.alphanumeric = alphanumeric;
  77. var decimal = {
  78. 'en-US': '.',
  79. ar: '٫'
  80. };
  81. exports.decimal = decimal;
  82. var englishLocales = ['AU', 'GB', 'HK', 'IN', 'NZ', 'ZA', 'ZM'];
  83. exports.englishLocales = englishLocales;
  84. for (var locale, i = 0; i < englishLocales.length; i++) {
  85. locale = "en-".concat(englishLocales[i]);
  86. alpha[locale] = alpha['en-US'];
  87. alphanumeric[locale] = alphanumeric['en-US'];
  88. decimal[locale] = decimal['en-US'];
  89. } // Source: http://www.localeplanet.com/java/
  90. var arabicLocales = ['AE', 'BH', 'DZ', 'EG', 'IQ', 'JO', 'KW', 'LB', 'LY', 'MA', 'QM', 'QA', 'SA', 'SD', 'SY', 'TN', 'YE'];
  91. exports.arabicLocales = arabicLocales;
  92. for (var _locale, _i = 0; _i < arabicLocales.length; _i++) {
  93. _locale = "ar-".concat(arabicLocales[_i]);
  94. alpha[_locale] = alpha.ar;
  95. alphanumeric[_locale] = alphanumeric.ar;
  96. decimal[_locale] = decimal.ar;
  97. }
  98. var farsiLocales = ['IR', 'AF'];
  99. exports.farsiLocales = farsiLocales;
  100. for (var _locale2, _i2 = 0; _i2 < farsiLocales.length; _i2++) {
  101. _locale2 = "fa-".concat(farsiLocales[_i2]);
  102. alphanumeric[_locale2] = alphanumeric.fa;
  103. decimal[_locale2] = decimal.ar;
  104. } // Source: https://en.wikipedia.org/wiki/Decimal_mark
  105. var dotDecimal = ['ar-EG', 'ar-LB', 'ar-LY'];
  106. exports.dotDecimal = dotDecimal;
  107. var commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-ZM', 'es-ES', 'fr-CA', 'fr-FR', 'id-ID', 'it-IT', 'ku-IQ', 'hi-IN', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN'];
  108. exports.commaDecimal = commaDecimal;
  109. for (var _i3 = 0; _i3 < dotDecimal.length; _i3++) {
  110. decimal[dotDecimal[_i3]] = decimal['en-US'];
  111. }
  112. for (var _i4 = 0; _i4 < commaDecimal.length; _i4++) {
  113. decimal[commaDecimal[_i4]] = ',';
  114. }
  115. alpha['fr-CA'] = alpha['fr-FR'];
  116. alphanumeric['fr-CA'] = alphanumeric['fr-FR'];
  117. alpha['pt-BR'] = alpha['pt-PT'];
  118. alphanumeric['pt-BR'] = alphanumeric['pt-PT'];
  119. decimal['pt-BR'] = decimal['pt-PT']; // see #862
  120. alpha['pl-Pl'] = alpha['pl-PL'];
  121. alphanumeric['pl-Pl'] = alphanumeric['pl-PL'];
  122. decimal['pl-Pl'] = decimal['pl-PL']; // see #1455
  123. alpha['fa-AF'] = alpha.fa;