index.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
  13. abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
  14. wide: /^(기원전|서기)/i
  15. };
  16. var parseEraPatterns = {
  17. any: [/^(bc|기원전)/i, /^(ad|서기)/i]
  18. };
  19. var matchQuarterPatterns = {
  20. narrow: /^[1234]/i,
  21. abbreviated: /^q[1234]/i,
  22. wide: /^[1234]사?분기/i
  23. };
  24. var parseQuarterPatterns = {
  25. any: [/1/i, /2/i, /3/i, /4/i]
  26. };
  27. var matchMonthPatterns = {
  28. narrow: /^(1[012]|[123456789])/,
  29. abbreviated: /^(1[012]|[123456789])월/i,
  30. wide: /^(1[012]|[123456789])월/i
  31. };
  32. var parseMonthPatterns = {
  33. any: [/^1월?$/, /^2/, /^3/, /^4/, /^5/, /^6/, /^7/, /^8/, /^9/, /^10/, /^11/, /^12/]
  34. };
  35. var matchDayPatterns = {
  36. narrow: /^[일월화수목금토]/,
  37. short: /^[일월화수목금토]/,
  38. abbreviated: /^[일월화수목금토]/,
  39. wide: /^[일월화수목금토]요일/
  40. };
  41. var parseDayPatterns = {
  42. any: [/^일/, /^월/, /^화/, /^수/, /^목/, /^금/, /^토/]
  43. };
  44. var matchDayPeriodPatterns = {
  45. any: /^(am|pm|오전|오후|자정|정오|아침|저녁|밤)/i
  46. };
  47. var parseDayPeriodPatterns = {
  48. any: {
  49. am: /^(am|오전)/i,
  50. pm: /^(pm|오후)/i,
  51. midnight: /^자정/i,
  52. noon: /^정오/i,
  53. morning: /^아침/i,
  54. afternoon: /^오후/i,
  55. evening: /^저녁/i,
  56. night: /^밤/i
  57. }
  58. };
  59. var match = {
  60. ordinalNumber: (0, _index2.default)({
  61. matchPattern: matchOrdinalNumberPattern,
  62. parsePattern: parseOrdinalNumberPattern,
  63. valueCallback: function valueCallback(value) {
  64. return parseInt(value, 10);
  65. }
  66. }),
  67. era: (0, _index.default)({
  68. matchPatterns: matchEraPatterns,
  69. defaultMatchWidth: 'wide',
  70. parsePatterns: parseEraPatterns,
  71. defaultParseWidth: 'any'
  72. }),
  73. quarter: (0, _index.default)({
  74. matchPatterns: matchQuarterPatterns,
  75. defaultMatchWidth: 'wide',
  76. parsePatterns: parseQuarterPatterns,
  77. defaultParseWidth: 'any',
  78. valueCallback: function valueCallback(index) {
  79. return index + 1;
  80. }
  81. }),
  82. month: (0, _index.default)({
  83. matchPatterns: matchMonthPatterns,
  84. defaultMatchWidth: 'wide',
  85. parsePatterns: parseMonthPatterns,
  86. defaultParseWidth: 'any'
  87. }),
  88. day: (0, _index.default)({
  89. matchPatterns: matchDayPatterns,
  90. defaultMatchWidth: 'wide',
  91. parsePatterns: parseDayPatterns,
  92. defaultParseWidth: 'any'
  93. }),
  94. dayPeriod: (0, _index.default)({
  95. matchPatterns: matchDayPeriodPatterns,
  96. defaultMatchWidth: 'any',
  97. parsePatterns: parseDayPeriodPatterns,
  98. defaultParseWidth: 'any'
  99. })
  100. };
  101. var _default = match;
  102. exports.default = _default;
  103. module.exports = exports.default;