timepiece/node_modules/date-fns/locale/ko/_lib/match.js

119 lines
2.8 KiB
JavaScript
Raw Normal View History

2024-05-14 14:54:12 +00:00
"use strict";
exports.match = void 0;
var _index = require("../../_lib/buildMatchFn.js");
var _index2 = require("../../_lib/buildMatchPatternFn.js");
const matchOrdinalNumberPattern = /^(\d+)(일|번째)?/i;
const parseOrdinalNumberPattern = /\d+/i;
const matchEraPatterns = {
narrow: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
wide: /^(기원전|서기)/i,
};
const parseEraPatterns = {
any: [/^(bc|기원전)/i, /^(ad|서기)/i],
};
const matchQuarterPatterns = {
narrow: /^[1234]/i,
abbreviated: /^q[1234]/i,
wide: /^[1234]사?분기/i,
};
const parseQuarterPatterns = {
any: [/1/i, /2/i, /3/i, /4/i],
};
const matchMonthPatterns = {
narrow: /^(1[012]|[123456789])/,
abbreviated: /^(1[012]|[123456789])월/i,
wide: /^(1[012]|[123456789])월/i,
};
const parseMonthPatterns = {
any: [
/^1월?$/,
/^2/,
/^3/,
/^4/,
/^5/,
/^6/,
/^7/,
/^8/,
/^9/,
/^10/,
/^11/,
/^12/,
],
};
const matchDayPatterns = {
narrow: /^[일월화수목금토]/,
short: /^[일월화수목금토]/,
abbreviated: /^[일월화수목금토]/,
wide: /^[일월화수목금토]요일/,
};
const parseDayPatterns = {
any: [/^일/, /^월/, /^화/, /^수/, /^목/, /^금/, /^토/],
};
const matchDayPeriodPatterns = {
any: /^(am|pm|오전|오후|자정|정오|아침|저녁|밤)/i,
};
const parseDayPeriodPatterns = {
any: {
am: /^(am|오전)/i,
pm: /^(pm|오후)/i,
midnight: /^자정/i,
noon: /^정오/i,
morning: /^아침/i,
afternoon: /^오후/i,
evening: /^저녁/i,
night: /^밤/i,
},
};
const match = (exports.match = {
ordinalNumber: (0, _index2.buildMatchPatternFn)({
matchPattern: matchOrdinalNumberPattern,
parsePattern: parseOrdinalNumberPattern,
valueCallback: (value) => parseInt(value, 10),
}),
era: (0, _index.buildMatchFn)({
matchPatterns: matchEraPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseEraPatterns,
defaultParseWidth: "any",
}),
quarter: (0, _index.buildMatchFn)({
matchPatterns: matchQuarterPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseQuarterPatterns,
defaultParseWidth: "any",
valueCallback: (index) => index + 1,
}),
month: (0, _index.buildMatchFn)({
matchPatterns: matchMonthPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseMonthPatterns,
defaultParseWidth: "any",
}),
day: (0, _index.buildMatchFn)({
matchPatterns: matchDayPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseDayPatterns,
defaultParseWidth: "any",
}),
dayPeriod: (0, _index.buildMatchFn)({
matchPatterns: matchDayPeriodPatterns,
defaultMatchWidth: "any",
parsePatterns: parseDayPeriodPatterns,
defaultParseWidth: "any",
}),
});