index.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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+)(d|na|tr|mh)?/i;
  10. var parseOrdinalNumberPattern = /\d+/i;
  11. var matchEraPatterns = {
  12. narrow: /^(r|a)/i,
  13. abbreviated: /^(r\.?\s?c\.?|r\.?\s?a\.?\s?c\.?|a\.?\s?d\.?|a\.?\s?c\.?)/i,
  14. wide: /^(ro Chrìosta|ron aois choitchinn|anno domini|aois choitcheann)/i
  15. };
  16. var parseEraPatterns = {
  17. any: [/^b/i, /^(a|c)/i]
  18. };
  19. var matchQuarterPatterns = {
  20. narrow: /^[1234]/i,
  21. abbreviated: /^c[1234]/i,
  22. wide: /^[1234](cd|na|tr|mh)? cairteal/i
  23. };
  24. var parseQuarterPatterns = {
  25. any: [/1/i, /2/i, /3/i, /4/i]
  26. };
  27. var matchMonthPatterns = {
  28. narrow: /^[fgmcòilsd]/i,
  29. abbreviated: /^(faoi|gear|màrt|gibl|cèit|ògmh|iuch|lùn|sult|dàmh|samh|dùbh)/i,
  30. wide: /^(am faoilleach|an gearran|am màrt|an giblean|an cèitean|an t-Ògmhios|an t-Iuchar|an lùnastal|an t-Sultain|an dàmhair|an t-Samhain|an dùbhlachd)/i
  31. };
  32. var parseMonthPatterns = {
  33. narrow: [/^f/i, /^g/i, /^m/i, /^g/i, /^c/i, /^ò/i, /^i/i, /^l/i, /^s/i, /^d/i, /^s/i, /^d/i],
  34. any: [/^fa/i, /^ge/i, /^mà/i, /^gi/i, /^c/i, /^ò/i, /^i/i, /^l/i, /^su/i, /^d/i, /^sa/i, /^d/i]
  35. };
  36. var matchDayPatterns = {
  37. narrow: /^[dlmcahs]/i,
  38. short: /^(dò|lu|mà|ci|ar|ha|sa)/i,
  39. abbreviated: /^(did|dil|dim|dic|dia|dih|dis)/i,
  40. wide: /^(didòmhnaich|diluain|dimàirt|diciadain|diardaoin|dihaoine|disathairne)/i
  41. };
  42. var parseDayPatterns = {
  43. narrow: [/^d/i, /^l/i, /^m/i, /^c/i, /^a/i, /^h/i, /^s/i],
  44. any: [/^d/i, /^l/i, /^m/i, /^c/i, /^a/i, /^h/i, /^s/i]
  45. };
  46. var matchDayPeriodPatterns = {
  47. narrow: /^(a|p|mi|n|(san|aig) (madainn|feasgar|feasgar|oidhche))/i,
  48. any: /^([ap]\.?\s?m\.?|meadhan oidhche|meadhan là|(san|aig) (madainn|feasgar|feasgar|oidhche))/i
  49. };
  50. var parseDayPeriodPatterns = {
  51. any: {
  52. am: /^m/i,
  53. pm: /^f/i,
  54. midnight: /^meadhan oidhche/i,
  55. noon: /^meadhan là/i,
  56. morning: /sa mhadainn/i,
  57. afternoon: /feasgar/i,
  58. evening: /feasgar/i,
  59. night: /air an oidhche/i
  60. }
  61. };
  62. var match = {
  63. ordinalNumber: (0, _index2.default)({
  64. matchPattern: matchOrdinalNumberPattern,
  65. parsePattern: parseOrdinalNumberPattern,
  66. valueCallback: function valueCallback(value) {
  67. return parseInt(value, 10);
  68. }
  69. }),
  70. era: (0, _index.default)({
  71. matchPatterns: matchEraPatterns,
  72. defaultMatchWidth: 'wide',
  73. parsePatterns: parseEraPatterns,
  74. defaultParseWidth: 'any'
  75. }),
  76. quarter: (0, _index.default)({
  77. matchPatterns: matchQuarterPatterns,
  78. defaultMatchWidth: 'wide',
  79. parsePatterns: parseQuarterPatterns,
  80. defaultParseWidth: 'any',
  81. valueCallback: function valueCallback(index) {
  82. return index + 1;
  83. }
  84. }),
  85. month: (0, _index.default)({
  86. matchPatterns: matchMonthPatterns,
  87. defaultMatchWidth: 'wide',
  88. parsePatterns: parseMonthPatterns,
  89. defaultParseWidth: 'any'
  90. }),
  91. day: (0, _index.default)({
  92. matchPatterns: matchDayPatterns,
  93. defaultMatchWidth: 'wide',
  94. parsePatterns: parseDayPatterns,
  95. defaultParseWidth: 'any'
  96. }),
  97. dayPeriod: (0, _index.default)({
  98. matchPatterns: matchDayPeriodPatterns,
  99. defaultMatchWidth: 'any',
  100. parsePatterns: parseDayPeriodPatterns,
  101. defaultParseWidth: 'any'
  102. })
  103. };
  104. var _default = match;
  105. exports.default = _default;
  106. module.exports = exports.default;