index.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _index = _interopRequireDefault(require("../../../_lib/buildMatchPatternFn/index.js"));
  7. var _index2 = _interopRequireDefault(require("../../../_lib/buildMatchFn/index.js"));
  8. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9. var matchOrdinalNumberPattern = /^(\d+)(\.)?/i;
  10. var parseOrdinalNumberPattern = /\d+/i;
  11. var matchEraPatterns = {
  12. narrow: /^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,
  13. abbreviated: /^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,
  14. wide: /^(viru Christus|virun eiser Zäitrechnung|no Christus|eiser Zäitrechnung)/i
  15. };
  16. var parseEraPatterns = {
  17. any: [/^v/i, /^n/i]
  18. };
  19. var matchQuarterPatterns = {
  20. narrow: /^[1234]/i,
  21. abbreviated: /^q[1234]/i,
  22. wide: /^[1234](\.)? Quartal/i
  23. };
  24. var parseQuarterPatterns = {
  25. any: [/1/i, /2/i, /3/i, /4/i]
  26. };
  27. var matchMonthPatterns = {
  28. narrow: /^[jfmasond]/i,
  29. abbreviated: /^(jan|feb|mäe|abr|mee|jun|jul|aug|sep|okt|nov|dez)/i,
  30. wide: /^(januar|februar|mäerz|abrëll|mee|juni|juli|august|september|oktober|november|dezember)/i
  31. };
  32. var parseMonthPatterns = {
  33. narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
  34. any: [/^ja/i, /^f/i, /^mä/i, /^ab/i, /^me/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
  35. };
  36. var matchDayPatterns = {
  37. narrow: /^[smdf]/i,
  38. short: /^(so|mé|dë|më|do|fr|sa)/i,
  39. abbreviated: /^(son?|méi?|dën?|mët?|don?|fre?|sam?)\.?/i,
  40. wide: /^(sonndeg|méindeg|dënschdeg|mëttwoch|donneschdeg|freideg|samschdeg)/i
  41. };
  42. var parseDayPatterns = {
  43. any: [/^so/i, /^mé/i, /^dë/i, /^më/i, /^do/i, /^f/i, /^sa/i]
  44. };
  45. var matchDayPeriodPatterns = {
  46. narrow: /^(mo\.?|nomë\.?|Mëtternuecht|mëttes|moies|nomëttes|owes|nuets)/i,
  47. abbreviated: /^(moi\.?|nomët\.?|Mëtternuecht|mëttes|moies|nomëttes|owes|nuets)/i,
  48. wide: /^(moies|nomëttes|Mëtternuecht|mëttes|moies|nomëttes|owes|nuets)/i
  49. };
  50. var parseDayPeriodPatterns = {
  51. any: {
  52. am: /^m/i,
  53. pm: /^n/i,
  54. midnight: /^Mëtter/i,
  55. noon: /^mëttes/i,
  56. morning: /moies/i,
  57. afternoon: /nomëttes/i,
  58. // will never be matched. Afternoon is matched by `pm`
  59. evening: /owes/i,
  60. night: /nuets/i // will never be matched. Night is matched by `pm`
  61. }
  62. };
  63. var match = {
  64. ordinalNumber: (0, _index.default)({
  65. matchPattern: matchOrdinalNumberPattern,
  66. parsePattern: parseOrdinalNumberPattern,
  67. valueCallback: function (value) {
  68. return parseInt(value, 10);
  69. }
  70. }),
  71. era: (0, _index2.default)({
  72. matchPatterns: matchEraPatterns,
  73. defaultMatchWidth: 'wide',
  74. parsePatterns: parseEraPatterns,
  75. defaultParseWidth: 'any'
  76. }),
  77. quarter: (0, _index2.default)({
  78. matchPatterns: matchQuarterPatterns,
  79. defaultMatchWidth: 'wide',
  80. parsePatterns: parseQuarterPatterns,
  81. defaultParseWidth: 'any',
  82. valueCallback: function (index) {
  83. return index + 1;
  84. }
  85. }),
  86. month: (0, _index2.default)({
  87. matchPatterns: matchMonthPatterns,
  88. defaultMatchWidth: 'wide',
  89. parsePatterns: parseMonthPatterns,
  90. defaultParseWidth: 'any'
  91. }),
  92. day: (0, _index2.default)({
  93. matchPatterns: matchDayPatterns,
  94. defaultMatchWidth: 'wide',
  95. parsePatterns: parseDayPatterns,
  96. defaultParseWidth: 'any'
  97. }),
  98. dayPeriod: (0, _index2.default)({
  99. matchPatterns: matchDayPeriodPatterns,
  100. defaultMatchWidth: 'wide',
  101. parsePatterns: parseDayPeriodPatterns,
  102. defaultParseWidth: 'any'
  103. })
  104. };
  105. var _default = match;
  106. exports.default = _default;
  107. module.exports = exports.default;