112 lines
4.0 KiB
JavaScript
112 lines
4.0 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: /^((до )?н\.?\s?э\.?)/i,
|
|||
|
abbreviated: /^((до )?н\.?\s?э\.?)/i,
|
|||
|
wide: /^(до нашей эры|нашей эры|наша эра)/i
|
|||
|
};
|
|||
|
var parseEraPatterns = {
|
|||
|
any: [/^д/i, /^н/i]
|
|||
|
};
|
|||
|
var matchQuarterPatterns = {
|
|||
|
narrow: /^[1234]/i,
|
|||
|
abbreviated: /^[1234](-?[ыои]?й?)? кв.?/i,
|
|||
|
wide: /^[1234](-?[ыои]?й?)? квартал/i
|
|||
|
};
|
|||
|
var parseQuarterPatterns = {
|
|||
|
any: [/1/i, /2/i, /3/i, /4/i]
|
|||
|
};
|
|||
|
var matchMonthPatterns = {
|
|||
|
narrow: /^[яфмаисонд]/i,
|
|||
|
abbreviated: /^(янв|фев|март?|апр|ма[йя]|июн[ья]?|июл[ья]?|авг|сент?|окт|нояб?|дек)\.?/i,
|
|||
|
wide: /^(январ[ья]|феврал[ья]|марта?|апрел[ья]|ма[йя]|июн[ья]|июл[ья]|августа?|сентябр[ья]|октябр[ья]|октябр[ья]|ноябр[ья]|декабр[ья])/i
|
|||
|
};
|
|||
|
var parseMonthPatterns = {
|
|||
|
narrow: [/^я/i, /^ф/i, /^м/i, /^а/i, /^м/i, /^и/i, /^и/i, /^а/i, /^с/i, /^о/i, /^н/i, /^я/i],
|
|||
|
any: [/^я/i, /^ф/i, /^мар/i, /^ап/i, /^ма[йя]/i, /^июн/i, /^июл/i, /^ав/i, /^с/i, /^о/i, /^н/i, /^д/i]
|
|||
|
};
|
|||
|
var matchDayPatterns = {
|
|||
|
narrow: /^[впсч]/i,
|
|||
|
short: /^(вс|во|пн|по|вт|ср|чт|че|пт|пя|сб|су)\.?/i,
|
|||
|
abbreviated: /^(вск|вос|пнд|пон|втр|вто|срд|сре|чтв|чет|птн|пят|суб).?/i,
|
|||
|
wide: /^(воскресень[ея]|понедельника?|вторника?|сред[аы]|четверга?|пятниц[аы]|суббот[аы])/i
|
|||
|
};
|
|||
|
var parseDayPatterns = {
|
|||
|
narrow: [/^в/i, /^п/i, /^в/i, /^с/i, /^ч/i, /^п/i, /^с/i],
|
|||
|
any: [/^в[ос]/i, /^п[он]/i, /^в/i, /^ср/i, /^ч/i, /^п[ят]/i, /^с[уб]/i]
|
|||
|
};
|
|||
|
var matchDayPeriodPatterns = {
|
|||
|
narrow: /^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,
|
|||
|
abbreviated: /^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,
|
|||
|
wide: /^([дп]п|полночь|полдень|утр[оа]|день|дня|вечера?|ноч[ьи])/i
|
|||
|
};
|
|||
|
var parseDayPeriodPatterns = {
|
|||
|
any: {
|
|||
|
am: /^дп/i,
|
|||
|
pm: /^пп/i,
|
|||
|
midnight: /^полн/i,
|
|||
|
noon: /^полд/i,
|
|||
|
morning: /^у/i,
|
|||
|
afternoon: /^д[ен]/i,
|
|||
|
evening: /^в/i,
|
|||
|
night: /^н/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: 'any',
|
|||
|
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;
|