index.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
  3. Object.defineProperty(exports, "__esModule", {
  4. value: true
  5. });
  6. exports.default = void 0;
  7. var _index = _interopRequireDefault(require("../../../_lib/buildMatchFn/index.js"));
  8. var _index2 = _interopRequireDefault(require("../../../_lib/buildMatchPatternFn/index.js"));
  9. var matchOrdinalNumberPattern = /^\d+\./i;
  10. var parseOrdinalNumberPattern = /\d+/i;
  11. var matchEraPatterns = {
  12. narrow: /^(e\.m\.a|m\.a\.j|eKr|pKr)/i,
  13. abbreviated: /^(e\.m\.a|m\.a\.j|eKr|pKr)/i,
  14. wide: /^(enne meie ajaarvamist|meie ajaarvamise järgi|enne Kristust|pärast Kristust)/i
  15. };
  16. var parseEraPatterns = {
  17. any: [/^e/i, /^(m|p)/i]
  18. };
  19. var matchQuarterPatterns = {
  20. narrow: /^[1234]/i,
  21. abbreviated: /^K[1234]/i,
  22. wide: /^[1234](\.)? kvartal/i
  23. };
  24. var parseQuarterPatterns = {
  25. any: [/1/i, /2/i, /3/i, /4/i]
  26. };
  27. var matchMonthPatterns = {
  28. narrow: /^[jvmasond]/i,
  29. abbreviated: /^(jaan|veebr|märts|apr|mai|juuni|juuli|aug|sept|okt|nov|dets)/i,
  30. wide: /^(jaanuar|veebruar|märts|aprill|mai|juuni|juuli|august|september|oktoober|november|detsember)/i
  31. };
  32. var parseMonthPatterns = {
  33. narrow: [/^j/i, /^v/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, /^v/i, /^mär/i, /^ap/i, /^mai/i, /^juun/i, /^juul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
  35. };
  36. var matchDayPatterns = {
  37. narrow: /^[petknrl]/i,
  38. short: /^[petknrl]/i,
  39. abbreviated: /^(püh?|esm?|tei?|kolm?|nel?|ree?|laup?)\.?/i,
  40. wide: /^(pühapäev|esmaspäev|teisipäev|kolmapäev|neljapäev|reede|laupäev)/i
  41. };
  42. var parseDayPatterns = {
  43. any: [/^p/i, /^e/i, /^t/i, /^k/i, /^n/i, /^r/i, /^l/i]
  44. };
  45. var matchDayPeriodPatterns = {
  46. any: /^(am|pm|keskööl?|keskpäev(al)?|hommik(ul)?|pärastlõunal?|õhtul?|öö(sel)?)/i
  47. };
  48. var parseDayPeriodPatterns = {
  49. any: {
  50. am: /^a/i,
  51. pm: /^p/i,
  52. midnight: /^keskö/i,
  53. noon: /^keskp/i,
  54. morning: /hommik/i,
  55. afternoon: /pärastlõuna/i,
  56. evening: /õhtu/i,
  57. night: /öö/i
  58. }
  59. };
  60. var match = {
  61. ordinalNumber: (0, _index2.default)({
  62. matchPattern: matchOrdinalNumberPattern,
  63. parsePattern: parseOrdinalNumberPattern,
  64. valueCallback: function valueCallback(value) {
  65. return parseInt(value, 10);
  66. }
  67. }),
  68. era: (0, _index.default)({
  69. matchPatterns: matchEraPatterns,
  70. defaultMatchWidth: 'wide',
  71. parsePatterns: parseEraPatterns,
  72. defaultParseWidth: 'any'
  73. }),
  74. quarter: (0, _index.default)({
  75. matchPatterns: matchQuarterPatterns,
  76. defaultMatchWidth: 'wide',
  77. parsePatterns: parseQuarterPatterns,
  78. defaultParseWidth: 'any',
  79. valueCallback: function valueCallback(index) {
  80. return index + 1;
  81. }
  82. }),
  83. month: (0, _index.default)({
  84. matchPatterns: matchMonthPatterns,
  85. defaultMatchWidth: 'wide',
  86. parsePatterns: parseMonthPatterns,
  87. defaultParseWidth: 'any'
  88. }),
  89. day: (0, _index.default)({
  90. matchPatterns: matchDayPatterns,
  91. defaultMatchWidth: 'wide',
  92. parsePatterns: parseDayPatterns,
  93. defaultParseWidth: 'any'
  94. }),
  95. dayPeriod: (0, _index.default)({
  96. matchPatterns: matchDayPeriodPatterns,
  97. defaultMatchWidth: 'any',
  98. parsePatterns: parseDayPeriodPatterns,
  99. defaultParseWidth: 'any'
  100. })
  101. };
  102. var _default = match;
  103. exports.default = _default;
  104. module.exports = exports.default;