113 lines
3.9 KiB
JavaScript
113 lines
3.9 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 = {
|
|||
|
any: [/^לפ/i, /^לס/i]
|
|||
|
};
|
|||
|
var matchQuarterPatterns = {
|
|||
|
narrow: /^[1234]/i,
|
|||
|
abbreviated: /^q[1234]/i,
|
|||
|
wide: /^רבעון [1234]/i
|
|||
|
};
|
|||
|
var parseQuarterPatterns = {
|
|||
|
any: [/1/i, /2/i, /3/i, /4/i]
|
|||
|
};
|
|||
|
var matchMonthPatterns = {
|
|||
|
narrow: /^\d+/i,
|
|||
|
abbreviated: /^(ינו|פבר|מרץ|אפר|מאי|יוני|יולי|אוג|ספט|אוק|נוב|דצמ)׳?/i,
|
|||
|
wide: /^(ינואר|פברואר|מרץ|אפריל|מאי|יוני|יולי|אוגוסט|ספטמבר|אוקטובר|נובמבר|דצמבר)/i
|
|||
|
};
|
|||
|
var parseMonthPatterns = {
|
|||
|
narrow: [/^1$/i, /^2/i, /^3/i, /^4/i, /^5/i, /^6/i, /^7/i, /^8/i, /^9/i, /^10/i, /^11/i, /^12/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 = {
|
|||
|
abbreviated: [/א׳$/i, /ב׳$/i, /ג׳$/i, /ד׳$/i, /ה׳$/i, /ו׳$/i, /^ש/i],
|
|||
|
wide: [/ן$/i, /ני$/i, /לישי$/i, /עי$/i, /מישי$/i, /שישי$/i, /ת$/i],
|
|||
|
any: [/^א/i, /^ב/i, /^ג/i, /^ד/i, /^ה/i, /^ו/i, /^ש/i]
|
|||
|
};
|
|||
|
var matchDayPeriodPatterns = {
|
|||
|
any: /^(אחר ה|ב)?(חצות|צהריים|בוקר|ערב|לילה|אחה״צ|לפנה״צ)/i
|
|||
|
};
|
|||
|
var parseDayPeriodPatterns = {
|
|||
|
any: {
|
|||
|
am: /^לפ/i,
|
|||
|
pm: /^אחה/i,
|
|||
|
midnight: /^ח/i,
|
|||
|
noon: /^צ/i,
|
|||
|
morning: /בוקר/i,
|
|||
|
afternoon: /בצ|אחר/i,
|
|||
|
evening: /ערב/i,
|
|||
|
night: /לילה/i
|
|||
|
}
|
|||
|
};
|
|||
|
var ordinalName = ['רא', 'שנ', 'של', 'רב', 'ח', 'שי', 'שב', 'שמ', 'ת', 'ע'];
|
|||
|
var match = {
|
|||
|
ordinalNumber: (0, _index2.default)({
|
|||
|
matchPattern: matchOrdinalNumberPattern,
|
|||
|
parsePattern: parseOrdinalNumberPattern,
|
|||
|
valueCallback: function valueCallback(value) {
|
|||
|
var number = parseInt(value, 10);
|
|||
|
return isNaN(number) ? ordinalName.indexOf(value) + 1 : number;
|
|||
|
}
|
|||
|
}),
|
|||
|
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: 'any',
|
|||
|
parsePatterns: parseDayPeriodPatterns,
|
|||
|
defaultParseWidth: 'any'
|
|||
|
})
|
|||
|
};
|
|||
|
var _default = match;
|
|||
|
exports.default = _default;
|
|||
|
module.exports = exports.default;
|