115 lines
5.2 KiB
JavaScript
115 lines
5.2 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: /^(āĻā§āĻ°āĻŋāĻāĻĒā§āĻ|āĻā§āĻ°āĻŋāĻ)/i,
|
|||
|
abbreviated: /^(āĻā§āĻ°āĻŋāĻāĻĒā§āĻ°ā§āĻŦ|āĻā§āĻ°āĻŋāĻ)/i,
|
|||
|
wide: /^(āĻā§āĻ°āĻŋāĻ¸ā§āĻāĻĒā§āĻ°ā§āĻŦ|āĻā§āĻ°āĻŋāĻ¸ā§āĻāĻžāĻŦā§āĻĻ)/i
|
|||
|
};
|
|||
|
var parseEraPatterns = {
|
|||
|
narrow: [/^āĻā§āĻ°āĻŋāĻāĻĒā§āĻ/i, /^āĻā§āĻ°āĻŋāĻ/i],
|
|||
|
abbreviated: [/^āĻā§āĻ°āĻŋāĻāĻĒā§āĻ°ā§āĻŦ/i, /^āĻā§āĻ°āĻŋāĻ/i],
|
|||
|
wide: [/^āĻā§āĻ°āĻŋāĻ¸ā§āĻāĻĒā§āĻ°ā§āĻŦ/i, /^āĻā§āĻ°āĻŋāĻ¸ā§āĻāĻžāĻŦā§āĻĻ/i]
|
|||
|
};
|
|||
|
var matchQuarterPatterns = {
|
|||
|
narrow: /^[ā§§ā§¨ā§Šā§Ē]/i,
|
|||
|
abbreviated: /^[ā§§ā§¨ā§Šā§Ē]āĻ¤ā§āĻ°ā§/i,
|
|||
|
wide: /^[ā§§ā§¨ā§Šā§Ē](āĻŽ|ā§|āĻ°ā§āĻĨ)? āĻ¤ā§āĻ°ā§āĻŽāĻžāĻ¸āĻŋāĻ/i
|
|||
|
};
|
|||
|
var parseQuarterPatterns = {
|
|||
|
any: [/ā§§/i, /ā§¨/i, /ā§Š/i, /ā§Ē/i]
|
|||
|
};
|
|||
|
var matchMonthPatterns = {
|
|||
|
narrow: /^(āĻāĻžāĻ¨ā§|āĻĢā§āĻŦā§āĻ°ā§|āĻŽāĻžāĻ°ā§āĻ|āĻāĻĒā§āĻ°āĻŋāĻ˛|āĻŽā§|āĻā§āĻ¨|āĻā§āĻ˛āĻžāĻ|āĻāĻāĻ¸ā§āĻ|āĻ¸ā§āĻĒā§āĻ|āĻ
āĻā§āĻā§|āĻ¨āĻā§|āĻĄāĻŋāĻ¸ā§)/i,
|
|||
|
abbreviated: /^(āĻāĻžāĻ¨ā§|āĻĢā§āĻŦā§āĻ°ā§|āĻŽāĻžāĻ°ā§āĻ|āĻāĻĒā§āĻ°āĻŋāĻ˛|āĻŽā§|āĻā§āĻ¨|āĻā§āĻ˛āĻžāĻ|āĻāĻāĻ¸ā§āĻ|āĻ¸ā§āĻĒā§āĻ|āĻ
āĻā§āĻā§|āĻ¨āĻā§|āĻĄāĻŋāĻ¸ā§)/i,
|
|||
|
wide: /^(āĻāĻžāĻ¨ā§ā§āĻžāĻ°āĻŋ|āĻĢā§āĻŦā§āĻ°ā§ā§āĻžāĻ°āĻŋ|āĻŽāĻžāĻ°ā§āĻ|āĻāĻĒā§āĻ°āĻŋāĻ˛|āĻŽā§|āĻā§āĻ¨|āĻā§āĻ˛āĻžāĻ|āĻāĻāĻ¸ā§āĻ|āĻ¸ā§āĻĒā§āĻā§āĻŽā§āĻŦāĻ°|āĻ
āĻā§āĻā§āĻŦāĻ°|āĻ¨āĻā§āĻŽā§āĻŦāĻ°|āĻĄāĻŋāĻ¸ā§āĻŽā§āĻŦāĻ°)/i
|
|||
|
};
|
|||
|
var parseMonthPatterns = {
|
|||
|
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],
|
|||
|
short: [/^āĻ°āĻŦāĻŋ/i, /^āĻ¸ā§āĻŽ/i, /^āĻŽāĻā§āĻāĻ˛/i, /^āĻŦā§āĻ§/i, /^āĻŦā§āĻš/i, /^āĻļā§āĻā§āĻ°/i, /^āĻļāĻ¨āĻŋ/i],
|
|||
|
abbreviated: [/^āĻ°āĻŦāĻŋ/i, /^āĻ¸ā§āĻŽ/i, /^āĻŽāĻā§āĻāĻ˛/i, /^āĻŦā§āĻ§/i, /^āĻŦā§āĻš/i, /^āĻļā§āĻā§āĻ°/i, /^āĻļāĻ¨āĻŋ/i],
|
|||
|
wide: [/^āĻ°āĻŦāĻŋāĻŦāĻžāĻ°/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: 'wide'
|
|||
|
}),
|
|||
|
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: 'wide'
|
|||
|
}),
|
|||
|
dayPeriod: (0, _index.default)({
|
|||
|
matchPatterns: matchDayPeriodPatterns,
|
|||
|
defaultMatchWidth: 'wide',
|
|||
|
parsePatterns: parseDayPeriodPatterns,
|
|||
|
defaultParseWidth: 'any'
|
|||
|
})
|
|||
|
};
|
|||
|
var _default = match;
|
|||
|
exports.default = _default;
|
|||
|
module.exports = exports.default;
|