index.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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+)e?/i;
  10. var parseOrdinalNumberPattern = /\d+/i;
  11. var matchEraPatterns = {
  12. narrow: /^([vn]\.? ?C\.?)/,
  13. abbreviated: /^([vn]\. ?Chr\.?)/,
  14. wide: /^((voor|na) Christus)/
  15. };
  16. var parseEraPatterns = {
  17. any: [/^v/, /^n/]
  18. };
  19. var matchQuarterPatterns = {
  20. narrow: /^[1234]/i,
  21. abbreviated: /^K[1234]/i,
  22. wide: /^[1234]e kwartaal/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.|mrt.|apr.|mei|jun.|jul.|aug.|sep.|okt.|nov.|dec.)/i,
  30. wide: /^(januari|februari|maart|april|mei|juni|juli|augustus|september|oktober|november|december)/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: [/^jan/i, /^feb/i, /^m(r|a)/i, /^apr/i, /^mei/i, /^jun/i, /^jul/i, /^aug/i, /^sep/i, /^okt/i, /^nov/i, /^dec/i]
  35. };
  36. var matchDayPatterns = {
  37. narrow: /^[zmdwv]/i,
  38. short: /^(zo|ma|di|wo|do|vr|za)/i,
  39. abbreviated: /^(zon|maa|din|woe|don|vri|zat)/i,
  40. wide: /^(zondag|maandag|dinsdag|woensdag|donderdag|vrijdag|zaterdag)/i
  41. };
  42. var parseDayPatterns = {
  43. narrow: [/^z/i, /^m/i, /^d/i, /^w/i, /^d/i, /^v/i, /^z/i],
  44. any: [/^zo/i, /^ma/i, /^di/i, /^wo/i, /^do/i, /^vr/i, /^za/i]
  45. };
  46. var matchDayPeriodPatterns = {
  47. any: /^(am|pm|middernacht|het middaguur|'s (ochtends|middags|avonds|nachts))/i
  48. };
  49. var parseDayPeriodPatterns = {
  50. any: {
  51. am: /^am/i,
  52. pm: /^pm/i,
  53. midnight: /^middernacht/i,
  54. noon: /^het middaguur/i,
  55. morning: /ochtend/i,
  56. afternoon: /middag/i,
  57. evening: /avond/i,
  58. night: /nacht/i
  59. }
  60. };
  61. var match = {
  62. ordinalNumber: (0, _index2.default)({
  63. matchPattern: matchOrdinalNumberPattern,
  64. parsePattern: parseOrdinalNumberPattern,
  65. valueCallback: function valueCallback(value) {
  66. return parseInt(value, 10);
  67. }
  68. }),
  69. era: (0, _index.default)({
  70. matchPatterns: matchEraPatterns,
  71. defaultMatchWidth: 'wide',
  72. parsePatterns: parseEraPatterns,
  73. defaultParseWidth: 'any'
  74. }),
  75. quarter: (0, _index.default)({
  76. matchPatterns: matchQuarterPatterns,
  77. defaultMatchWidth: 'wide',
  78. parsePatterns: parseQuarterPatterns,
  79. defaultParseWidth: 'any',
  80. valueCallback: function valueCallback(index) {
  81. return index + 1;
  82. }
  83. }),
  84. month: (0, _index.default)({
  85. matchPatterns: matchMonthPatterns,
  86. defaultMatchWidth: 'wide',
  87. parsePatterns: parseMonthPatterns,
  88. defaultParseWidth: 'any'
  89. }),
  90. day: (0, _index.default)({
  91. matchPatterns: matchDayPatterns,
  92. defaultMatchWidth: 'wide',
  93. parsePatterns: parseDayPatterns,
  94. defaultParseWidth: 'any'
  95. }),
  96. dayPeriod: (0, _index.default)({
  97. matchPatterns: matchDayPeriodPatterns,
  98. defaultMatchWidth: 'any',
  99. parsePatterns: parseDayPeriodPatterns,
  100. defaultParseWidth: 'any'
  101. })
  102. };
  103. var _default = match;
  104. exports.default = _default;
  105. module.exports = exports.default;