136 lines
3.3 KiB
JavaScript
136 lines
3.3 KiB
JavaScript
"use strict";
|
|
exports.match = void 0;
|
|
|
|
var _index = require("../../_lib/buildMatchFn.js");
|
|
var _index2 = require("../../_lib/buildMatchPatternFn.js");
|
|
|
|
const matchOrdinalNumberPattern = /^(\d+)(d|na|tr|mh)?/i;
|
|
const parseOrdinalNumberPattern = /\d+/i;
|
|
|
|
const matchEraPatterns = {
|
|
narrow: /^(r|a)/i,
|
|
abbreviated: /^(r\.?\s?c\.?|r\.?\s?a\.?\s?c\.?|a\.?\s?d\.?|a\.?\s?c\.?)/i,
|
|
wide: /^(ro Chrìosta|ron aois choitchinn|anno domini|aois choitcheann)/i,
|
|
};
|
|
const parseEraPatterns = {
|
|
any: [/^b/i, /^(a|c)/i],
|
|
};
|
|
|
|
const matchQuarterPatterns = {
|
|
narrow: /^[1234]/i,
|
|
abbreviated: /^c[1234]/i,
|
|
wide: /^[1234](cd|na|tr|mh)? cairteal/i,
|
|
};
|
|
const parseQuarterPatterns = {
|
|
any: [/1/i, /2/i, /3/i, /4/i],
|
|
};
|
|
|
|
const matchMonthPatterns = {
|
|
narrow: /^[fgmcòilsd]/i,
|
|
abbreviated: /^(faoi|gear|màrt|gibl|cèit|ògmh|iuch|lùn|sult|dàmh|samh|dùbh)/i,
|
|
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,
|
|
};
|
|
const parseMonthPatterns = {
|
|
narrow: [
|
|
/^f/i,
|
|
/^g/i,
|
|
/^m/i,
|
|
/^g/i,
|
|
/^c/i,
|
|
/^ò/i,
|
|
/^i/i,
|
|
/^l/i,
|
|
/^s/i,
|
|
/^d/i,
|
|
/^s/i,
|
|
/^d/i,
|
|
],
|
|
|
|
any: [
|
|
/^fa/i,
|
|
/^ge/i,
|
|
/^mà/i,
|
|
/^gi/i,
|
|
/^c/i,
|
|
/^ò/i,
|
|
/^i/i,
|
|
/^l/i,
|
|
/^su/i,
|
|
/^d/i,
|
|
/^sa/i,
|
|
/^d/i,
|
|
],
|
|
};
|
|
|
|
const matchDayPatterns = {
|
|
narrow: /^[dlmcahs]/i,
|
|
short: /^(dò|lu|mà|ci|ar|ha|sa)/i,
|
|
abbreviated: /^(did|dil|dim|dic|dia|dih|dis)/i,
|
|
wide: /^(didòmhnaich|diluain|dimàirt|diciadain|diardaoin|dihaoine|disathairne)/i,
|
|
};
|
|
const parseDayPatterns = {
|
|
narrow: [/^d/i, /^l/i, /^m/i, /^c/i, /^a/i, /^h/i, /^s/i],
|
|
any: [/^d/i, /^l/i, /^m/i, /^c/i, /^a/i, /^h/i, /^s/i],
|
|
};
|
|
|
|
const matchDayPeriodPatterns = {
|
|
narrow: /^(a|p|mi|n|(san|aig) (madainn|feasgar|feasgar|oidhche))/i,
|
|
any: /^([ap]\.?\s?m\.?|meadhan oidhche|meadhan là|(san|aig) (madainn|feasgar|feasgar|oidhche))/i,
|
|
};
|
|
const parseDayPeriodPatterns = {
|
|
any: {
|
|
am: /^m/i,
|
|
pm: /^f/i,
|
|
midnight: /^meadhan oidhche/i,
|
|
noon: /^meadhan là/i,
|
|
morning: /sa mhadainn/i,
|
|
afternoon: /feasgar/i,
|
|
evening: /feasgar/i,
|
|
night: /air an oidhche/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",
|
|
}),
|
|
});
|