114 lines
3.7 KiB
JavaScript
114 lines
3.7 KiB
JavaScript
|
"use strict";
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports.default = void 0;
|
||
|
|
||
|
var _index = _interopRequireDefault(require("../../../_lib/buildMatchFn/index.js"));
|
||
|
|
||
|
var _index2 = _interopRequireDefault(require("../../../_lib/buildMatchPatternFn/index.js"));
|
||
|
|
||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
|
||
|
var matchOrdinalNumberPattern = /^(\d+)\./i;
|
||
|
var parseOrdinalNumberPattern = /\d+/i;
|
||
|
var matchEraPatterns = {
|
||
|
narrow: /^(p\.m\.ē|m\.ē)/i,
|
||
|
abbreviated: /^(p\. m\. ē\.|m\. ē\.)/i,
|
||
|
wide: /^(pirms mūsu ēras|mūsu ērā)/i
|
||
|
};
|
||
|
var parseEraPatterns = {
|
||
|
any: [/^p/i, /^m/i]
|
||
|
};
|
||
|
var matchQuarterPatterns = {
|
||
|
narrow: /^[1234]/i,
|
||
|
abbreviated: /^[1234](\. cet\.)/i,
|
||
|
wide: /^(pirma(is|jā)|otra(is|jā)|treša(is|jā)|ceturta(is|jā)) ceturksn(is|ī)/i
|
||
|
};
|
||
|
var parseQuarterPatterns = {
|
||
|
narrow: [/^1/i, /^2/i, /^3/i, /^4/i],
|
||
|
abbreviated: [/^1/i, /^2/i, /^3/i, /^4/i],
|
||
|
wide: [/^p/i, /^o/i, /^t/i, /^c/i]
|
||
|
};
|
||
|
var matchMonthPatterns = {
|
||
|
narrow: /^[jfmasond]/i,
|
||
|
abbreviated: /^(janv\.|febr\.|marts|apr\.|maijs|jūn\.|jūl\.|aug\.|sept\.|okt\.|nov\.|dec\.)/i,
|
||
|
wide: /^(janvār(is|ī)|februār(is|ī)|mart[sā]|aprīl(is|ī)|maij[sā]|jūnij[sā]|jūlij[sā]|august[sā]|septembr(is|ī)|oktobr(is|ī)|novembr(is|ī)|decembr(is|ī))/i
|
||
|
};
|
||
|
var parseMonthPatterns = {
|
||
|
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],
|
||
|
any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^mai/i, /^jūn/i, /^jūl/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
|
||
|
};
|
||
|
var matchDayPatterns = {
|
||
|
narrow: /^[spotc]/i,
|
||
|
short: /^(sv|pi|o|t|c|pk|s)/i,
|
||
|
abbreviated: /^(svētd\.|pirmd\.|otrd.\|trešd\.|ceturtd\.|piektd\.|sestd\.)/i,
|
||
|
wide: /^(svētdien(a|ā)|pirmdien(a|ā)|otrdien(a|ā)|trešdien(a|ā)|ceturtdien(a|ā)|piektdien(a|ā)|sestdien(a|ā))/i
|
||
|
};
|
||
|
var parseDayPatterns = {
|
||
|
narrow: [/^s/i, /^p/i, /^o/i, /^t/i, /^c/i, /^p/i, /^s/i],
|
||
|
any: [/^sv/i, /^pi/i, /^o/i, /^t/i, /^c/i, /^p/i, /^se/i]
|
||
|
};
|
||
|
var matchDayPeriodPatterns = {
|
||
|
narrow: /^(am|pm|pusn\.|pusd\.|rīt(s|ā)|dien(a|ā)|vakar(s|ā)|nakt(s|ī))/,
|
||
|
abbreviated: /^(am|pm|pusn\.|pusd\.|rīt(s|ā)|pēcpusd\.|vakar(s|ā)|nakt(s|ī))/,
|
||
|
wide: /^(am|pm|pusnakt(s|ī)|pusdienlaik(s|ā)|rīt(s|ā)|pēcpusdien(a|ā)|vakar(s|ā)|nakt(s|ī))/i
|
||
|
};
|
||
|
var parseDayPeriodPatterns = {
|
||
|
any: {
|
||
|
am: /^am/i,
|
||
|
pm: /^pm/i,
|
||
|
midnight: /^pusn/i,
|
||
|
noon: /^pusd/i,
|
||
|
morning: /^r/i,
|
||
|
afternoon: /^(d|pēc)/i,
|
||
|
evening: /^v/i,
|
||
|
night: /^n/i
|
||
|
}
|
||
|
};
|
||
|
var match = {
|
||
|
ordinalNumber: (0, _index2.default)({
|
||
|
matchPattern: matchOrdinalNumberPattern,
|
||
|
parsePattern: parseOrdinalNumberPattern,
|
||
|
valueCallback: function valueCallback(value) {
|
||
|
return parseInt(value, 10);
|
||
|
}
|
||
|
}),
|
||
|
era: (0, _index.default)({
|
||
|
matchPatterns: matchEraPatterns,
|
||
|
defaultMatchWidth: 'wide',
|
||
|
parsePatterns: parseEraPatterns,
|
||
|
defaultParseWidth: 'any'
|
||
|
}),
|
||
|
quarter: (0, _index.default)({
|
||
|
matchPatterns: matchQuarterPatterns,
|
||
|
defaultMatchWidth: 'wide',
|
||
|
parsePatterns: parseQuarterPatterns,
|
||
|
defaultParseWidth: 'wide',
|
||
|
valueCallback: function valueCallback(index) {
|
||
|
return index + 1;
|
||
|
}
|
||
|
}),
|
||
|
month: (0, _index.default)({
|
||
|
matchPatterns: matchMonthPatterns,
|
||
|
defaultMatchWidth: 'wide',
|
||
|
parsePatterns: parseMonthPatterns,
|
||
|
defaultParseWidth: 'any'
|
||
|
}),
|
||
|
day: (0, _index.default)({
|
||
|
matchPatterns: matchDayPatterns,
|
||
|
defaultMatchWidth: 'wide',
|
||
|
parsePatterns: parseDayPatterns,
|
||
|
defaultParseWidth: 'any'
|
||
|
}),
|
||
|
dayPeriod: (0, _index.default)({
|
||
|
matchPatterns: matchDayPeriodPatterns,
|
||
|
defaultMatchWidth: 'wide',
|
||
|
parsePatterns: parseDayPeriodPatterns,
|
||
|
defaultParseWidth: 'any'
|
||
|
})
|
||
|
};
|
||
|
var _default = match;
|
||
|
exports.default = _default;
|
||
|
module.exports = exports.default;
|