@hebcal/rest-api 5.1.0 → 5.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -332
- package/dist/bundle.js +150 -153
- package/dist/bundle.min.js +2 -2
- package/dist/common.d.ts +1 -0
- package/dist/fullcalendar.js +119 -136
- package/dist/fullcalendar.min.js +2 -2
- package/dist/index.cjs +150 -153
- package/dist/index.mjs +150 -153
- package/package.json +10 -11
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/rest-api v5.1.
|
|
1
|
+
/*! @hebcal/rest-api v5.1.2 */
|
|
2
2
|
import { flags, HDate, HebrewCalendar, Zmanim, Locale as Locale$1, gematriya } from '@hebcal/core';
|
|
3
3
|
import { getLeyningForParshaHaShavua, getLeyningForHoliday, formatAliyahWithBook } from '@hebcal/leyning';
|
|
4
4
|
import { getTriennialForParshaHaShavua } from '@hebcal/triennial';
|
|
@@ -41,107 +41,106 @@ function yearFromFixed(abs) {
|
|
|
41
41
|
const ABS_14SEP1752 = 639797;
|
|
42
42
|
const ABS_2SEP1752 = 639785;
|
|
43
43
|
*/
|
|
44
|
+
/*
|
|
45
|
+
* Formerly in namespace, now top-level
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* Returns true if the Gregorian year is a leap year
|
|
49
|
+
* @param year Gregorian year
|
|
50
|
+
*/
|
|
51
|
+
function isGregLeapYear(year) {
|
|
52
|
+
return !(year % 4) && (!!(year % 100) || !(year % 400));
|
|
53
|
+
}
|
|
44
54
|
/**
|
|
45
|
-
* Gregorian
|
|
55
|
+
* Number of days in the Gregorian month for given year
|
|
56
|
+
* @param month Gregorian month (1=January, 12=December)
|
|
57
|
+
* @param year Gregorian year
|
|
58
|
+
*/
|
|
59
|
+
function daysInGregMonth(month, year) {
|
|
60
|
+
// 1 based months
|
|
61
|
+
return monthLengths[+isGregLeapYear(year)][month];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Returns true if the object is a Javascript Date
|
|
65
|
+
*/
|
|
66
|
+
function isDate(obj) {
|
|
67
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
68
|
+
return typeof obj === 'object' && Date.prototype.isPrototypeOf(obj);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @private
|
|
72
|
+
* @param year
|
|
73
|
+
* @param month (1-12)
|
|
74
|
+
* @param day (1-31)
|
|
75
|
+
*/
|
|
76
|
+
function toFixed(year, month, day) {
|
|
77
|
+
const py = year - 1;
|
|
78
|
+
return (365 * py +
|
|
79
|
+
quotient(py, 4) -
|
|
80
|
+
quotient(py, 100) +
|
|
81
|
+
quotient(py, 400) +
|
|
82
|
+
quotient(367 * month - 362, 12) +
|
|
83
|
+
(month <= 2 ? 0 : isGregLeapYear(year) ? -1 : -2) +
|
|
84
|
+
day);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
88
|
+
* @param date Gregorian date
|
|
89
|
+
*/
|
|
90
|
+
function greg2abs(date) {
|
|
91
|
+
if (!isDate(date)) {
|
|
92
|
+
throw new TypeError(`Argument not a Date: ${date}`);
|
|
93
|
+
}
|
|
94
|
+
const abs = toFixed(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
95
|
+
/*
|
|
96
|
+
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
97
|
+
throw new RangeError(`Invalid Date: ${date}`);
|
|
98
|
+
}
|
|
99
|
+
*/
|
|
100
|
+
return abs;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
104
|
+
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
105
|
+
* Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
|
|
106
|
+
* Clamen, Software--Practice and Experience, Volume 23, Number 4
|
|
107
|
+
* (April, 1993), pages 383-404 for an explanation.
|
|
108
|
+
* @param abs - R.D. number of days
|
|
109
|
+
*/
|
|
110
|
+
function abs2greg(abs) {
|
|
111
|
+
if (typeof abs !== 'number') {
|
|
112
|
+
throw new TypeError(`Argument not a Number: ${abs}`);
|
|
113
|
+
}
|
|
114
|
+
abs = Math.trunc(abs);
|
|
115
|
+
/*
|
|
116
|
+
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
117
|
+
throw new RangeError(`Invalid Date: ${abs}`);
|
|
118
|
+
}
|
|
119
|
+
*/
|
|
120
|
+
const year = yearFromFixed(abs);
|
|
121
|
+
const priorDays = abs - toFixed(year, 1, 1);
|
|
122
|
+
const correction = abs < toFixed(year, 3, 1) ? 0 : isGregLeapYear(year) ? 1 : 2;
|
|
123
|
+
const month = quotient(12 * (priorDays + correction) + 373, 367);
|
|
124
|
+
const day = abs - toFixed(year, month, 1) + 1;
|
|
125
|
+
const dt = new Date(year, month - 1, day);
|
|
126
|
+
if (year < 100 && year >= 0) {
|
|
127
|
+
dt.setFullYear(year);
|
|
128
|
+
}
|
|
129
|
+
return dt;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-namespace */
|
|
133
|
+
/**
|
|
134
|
+
* Gregorian date helper functions
|
|
46
135
|
*/
|
|
47
136
|
var greg;
|
|
48
137
|
(function (greg) {
|
|
49
|
-
/**
|
|
50
|
-
* Returns true if the Gregorian year is a leap year
|
|
51
|
-
* @param {number} year Gregorian year
|
|
52
|
-
* @return {boolean}
|
|
53
|
-
*/
|
|
54
|
-
function isLeapYear(year) {
|
|
55
|
-
return !(year % 4) && (!!(year % 100) || !(year % 400));
|
|
56
|
-
}
|
|
57
|
-
greg.isLeapYear = isLeapYear;
|
|
58
|
-
/**
|
|
59
|
-
* Number of days in the Gregorian month for given year
|
|
60
|
-
* @param {number} month Gregorian month (1=January, 12=December)
|
|
61
|
-
* @param {number} year Gregorian year
|
|
62
|
-
* @return {number}
|
|
63
|
-
*/
|
|
64
|
-
function daysInMonth(month, year) {
|
|
65
|
-
// 1 based months
|
|
66
|
-
return monthLengths[+isLeapYear(year)][month];
|
|
67
|
-
}
|
|
68
|
-
greg.daysInMonth = daysInMonth;
|
|
69
|
-
/**
|
|
70
|
-
* Returns true if the object is a Javascript Date
|
|
71
|
-
* @param {Object} obj
|
|
72
|
-
* @return {boolean}
|
|
73
|
-
*/
|
|
74
|
-
function isDate(obj) {
|
|
75
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
76
|
-
return typeof obj === 'object' && Date.prototype.isPrototypeOf(obj);
|
|
77
|
-
}
|
|
78
|
-
greg.isDate = isDate;
|
|
79
|
-
/**
|
|
80
|
-
* @private
|
|
81
|
-
* @param year
|
|
82
|
-
* @param month (1-12)
|
|
83
|
-
* @param day (1-31)
|
|
84
|
-
*/
|
|
85
|
-
function toFixed(year, month, day) {
|
|
86
|
-
const py = year - 1;
|
|
87
|
-
return (365 * py +
|
|
88
|
-
quotient(py, 4) -
|
|
89
|
-
quotient(py, 100) +
|
|
90
|
-
quotient(py, 400) +
|
|
91
|
-
quotient(367 * month - 362, 12) +
|
|
92
|
-
(month <= 2 ? 0 : isLeapYear(year) ? -1 : -2) +
|
|
93
|
-
day);
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Converts Gregorian date to absolute R.D. (Rata Die) days
|
|
97
|
-
* @param {Date} date Gregorian date
|
|
98
|
-
* @return {number}
|
|
99
|
-
*/
|
|
100
|
-
function greg2abs(date) {
|
|
101
|
-
if (!isDate(date)) {
|
|
102
|
-
throw new TypeError(`Argument not a Date: ${date}`);
|
|
103
|
-
}
|
|
104
|
-
const abs = toFixed(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
105
|
-
/*
|
|
106
|
-
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
107
|
-
throw new RangeError(`Invalid Date: ${date}`);
|
|
108
|
-
}
|
|
109
|
-
*/
|
|
110
|
-
return abs;
|
|
111
|
-
}
|
|
112
|
-
greg.greg2abs = greg2abs;
|
|
113
|
-
/**
|
|
114
|
-
* Converts from Rata Die (R.D. number) to Gregorian date.
|
|
115
|
-
* See the footnote on page 384 of ``Calendrical Calculations, Part II:
|
|
116
|
-
* Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
|
|
117
|
-
* Clamen, Software--Practice and Experience, Volume 23, Number 4
|
|
118
|
-
* (April, 1993), pages 383-404 for an explanation.
|
|
119
|
-
* @param {number} abs - R.D. number of days
|
|
120
|
-
* @return {Date}
|
|
121
|
-
*/
|
|
122
|
-
function abs2greg(abs) {
|
|
123
|
-
if (typeof abs !== 'number') {
|
|
124
|
-
throw new TypeError(`Argument not a Number: ${abs}`);
|
|
125
|
-
}
|
|
126
|
-
abs = Math.trunc(abs);
|
|
127
|
-
/*
|
|
128
|
-
if (abs < ABS_14SEP1752 && abs > ABS_2SEP1752) {
|
|
129
|
-
throw new RangeError(`Invalid Date: ${abs}`);
|
|
130
|
-
}
|
|
131
|
-
*/
|
|
132
|
-
const year = yearFromFixed(abs);
|
|
133
|
-
const priorDays = abs - toFixed(year, 1, 1);
|
|
134
|
-
const correction = abs < toFixed(year, 3, 1) ? 0 : isLeapYear(year) ? 1 : 2;
|
|
135
|
-
const month = quotient(12 * (priorDays + correction) + 373, 367);
|
|
136
|
-
const day = abs - toFixed(year, month, 1) + 1;
|
|
137
|
-
const dt = new Date(year, month - 1, day);
|
|
138
|
-
if (year < 100 && year >= 0) {
|
|
139
|
-
dt.setFullYear(year);
|
|
140
|
-
}
|
|
141
|
-
return dt;
|
|
142
|
-
}
|
|
143
|
-
greg.abs2greg = abs2greg;
|
|
144
138
|
})(greg || (greg = {}));
|
|
139
|
+
greg.abs2greg = abs2greg;
|
|
140
|
+
greg.daysInMonth = daysInGregMonth;
|
|
141
|
+
greg.greg2abs = greg2abs;
|
|
142
|
+
greg.isDate = isDate;
|
|
143
|
+
greg.isLeapYear = isGregLeapYear;
|
|
145
144
|
|
|
146
145
|
const alefbet = {
|
|
147
146
|
א: 1,
|
|
@@ -179,8 +178,6 @@ for (const [key, val] of Object.entries(alefbet)) {
|
|
|
179
178
|
* Similar to `string.padStart(4, '0')` but will also format
|
|
180
179
|
* negative numbers similar to how the JavaScript date formats
|
|
181
180
|
* negative year numbers (e.g. `-37` is formatted as `-000037`).
|
|
182
|
-
* @param {number} number
|
|
183
|
-
* @return {string}
|
|
184
181
|
*/
|
|
185
182
|
function pad4(number) {
|
|
186
183
|
if (number < 0) {
|
|
@@ -200,8 +197,6 @@ function pad4(number) {
|
|
|
200
197
|
/**
|
|
201
198
|
* Formats a number with leading zeros so the resulting string is 2 digits long.
|
|
202
199
|
* Similar to `string.padStart(2, '0')`.
|
|
203
|
-
* @param {number} number
|
|
204
|
-
* @return {string}
|
|
205
200
|
*/
|
|
206
201
|
function pad2(number) {
|
|
207
202
|
if (number < 10) {
|
|
@@ -211,9 +206,6 @@ function pad2(number) {
|
|
|
211
206
|
}
|
|
212
207
|
/**
|
|
213
208
|
* Returns YYYY-MM-DD in the local timezone
|
|
214
|
-
* @private
|
|
215
|
-
* @param {Date} dt
|
|
216
|
-
* @return {string}
|
|
217
209
|
*/
|
|
218
210
|
function isoDateString(dt) {
|
|
219
211
|
return (pad4(dt.getFullYear()) +
|
|
@@ -232,9 +224,9 @@ const noopLocale = {
|
|
|
232
224
|
contexts: { '': {} },
|
|
233
225
|
};
|
|
234
226
|
const alias = {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
227
|
+
h: 'he',
|
|
228
|
+
a: 'ashkenazi',
|
|
229
|
+
s: 'en',
|
|
238
230
|
'': 'en',
|
|
239
231
|
};
|
|
240
232
|
/** @private */
|
|
@@ -255,12 +247,12 @@ class Locale {
|
|
|
255
247
|
/**
|
|
256
248
|
* Returns translation only if `locale` offers a non-empty translation for `id`.
|
|
257
249
|
* Otherwise, returns `undefined`.
|
|
258
|
-
* @param
|
|
259
|
-
* @param
|
|
260
|
-
* @return {string}
|
|
250
|
+
* @param id Message ID to translate
|
|
251
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
261
252
|
*/
|
|
262
253
|
static lookupTranslation(id, locale) {
|
|
263
|
-
const loc = (typeof locale === 'string' && locales.get(locale.toLowerCase())) ||
|
|
254
|
+
const loc = (typeof locale === 'string' && locales.get(locale.toLowerCase())) ||
|
|
255
|
+
activeLocale;
|
|
264
256
|
const array = loc[id];
|
|
265
257
|
if ((array === null || array === void 0 ? void 0 : array.length) && array[0].length) {
|
|
266
258
|
return array[0];
|
|
@@ -269,9 +261,8 @@ class Locale {
|
|
|
269
261
|
}
|
|
270
262
|
/**
|
|
271
263
|
* By default, if no translation was found, returns `id`.
|
|
272
|
-
* @param
|
|
273
|
-
* @param
|
|
274
|
-
* @return {string}
|
|
264
|
+
* @param id Message ID to translate
|
|
265
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
275
266
|
*/
|
|
276
267
|
static gettext(id, locale) {
|
|
277
268
|
const text = this.lookupTranslation(id, locale);
|
|
@@ -282,23 +273,24 @@ class Locale {
|
|
|
282
273
|
}
|
|
283
274
|
/**
|
|
284
275
|
* Register locale translations.
|
|
285
|
-
* @param
|
|
286
|
-
* @param
|
|
276
|
+
* @param locale Locale name (i.e.: `'he'`, `'fr'`)
|
|
277
|
+
* @param data parsed data from a `.po` file.
|
|
287
278
|
*/
|
|
288
279
|
static addLocale(locale, data) {
|
|
289
280
|
if (typeof locale !== 'string') {
|
|
290
281
|
throw new TypeError(`Invalid locale name: ${locale}`);
|
|
291
282
|
}
|
|
292
|
-
if (typeof data.contexts !== 'object' ||
|
|
283
|
+
if (typeof data.contexts !== 'object' ||
|
|
284
|
+
typeof data.contexts[''] !== 'object') {
|
|
293
285
|
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
294
286
|
}
|
|
295
287
|
locales.set(locale.toLowerCase(), data.contexts['']);
|
|
296
288
|
}
|
|
297
289
|
/**
|
|
298
290
|
* Adds a translation to `locale`, replacing any previous translation.
|
|
299
|
-
* @param
|
|
300
|
-
* @param
|
|
301
|
-
* @param
|
|
291
|
+
* @param locale Locale name (i.e: `'he'`, `'fr'`).
|
|
292
|
+
* @param id Message ID to translate
|
|
293
|
+
* @param translation Translation text
|
|
302
294
|
*/
|
|
303
295
|
static addTranslation(locale, id, translation) {
|
|
304
296
|
if (typeof locale !== 'string') {
|
|
@@ -325,8 +317,8 @@ class Locale {
|
|
|
325
317
|
}
|
|
326
318
|
/**
|
|
327
319
|
* Adds multiple translations to `locale`, replacing any previous translations.
|
|
328
|
-
* @param
|
|
329
|
-
* @param
|
|
320
|
+
* @param locale Locale name (i.e: `'he'`, `'fr'`).
|
|
321
|
+
* @param data parsed data from a `.po` file.
|
|
330
322
|
*/
|
|
331
323
|
static addTranslations(locale, data) {
|
|
332
324
|
if (typeof locale !== 'string') {
|
|
@@ -336,7 +328,8 @@ class Locale {
|
|
|
336
328
|
if (!loc) {
|
|
337
329
|
throw new TypeError(`Unknown locale: ${locale}`);
|
|
338
330
|
}
|
|
339
|
-
if (typeof data.contexts !== 'object' ||
|
|
331
|
+
if (typeof data.contexts !== 'object' ||
|
|
332
|
+
typeof data.contexts[''] !== 'object') {
|
|
340
333
|
throw new TypeError(`Locale '${locale}' invalid compact format`);
|
|
341
334
|
}
|
|
342
335
|
const ctx = data.contexts[''];
|
|
@@ -346,7 +339,7 @@ class Locale {
|
|
|
346
339
|
* Activates a locale. Throws an error if the locale has not been previously added.
|
|
347
340
|
* After setting the locale to be used, all strings marked for translations
|
|
348
341
|
* will be represented by the corresponding translation in the specified locale.
|
|
349
|
-
* @param
|
|
342
|
+
* @param locale Locale name (i.e: `'he'`, `'fr'`)
|
|
350
343
|
*/
|
|
351
344
|
static useLocale(locale) {
|
|
352
345
|
const locale0 = locale.toLowerCase();
|
|
@@ -360,23 +353,20 @@ class Locale {
|
|
|
360
353
|
}
|
|
361
354
|
/**
|
|
362
355
|
* Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
|
|
363
|
-
* @return {string}
|
|
364
356
|
*/
|
|
365
357
|
static getLocaleName() {
|
|
366
358
|
return activeName;
|
|
367
359
|
}
|
|
368
360
|
/**
|
|
369
361
|
* Returns the names of registered locales
|
|
370
|
-
* @return {string[]}
|
|
371
362
|
*/
|
|
372
363
|
static getLocaleNames() {
|
|
373
364
|
const keys = Array.from(locales.keys());
|
|
374
365
|
return keys.sort((a, b) => a.localeCompare(b));
|
|
375
366
|
}
|
|
376
367
|
/**
|
|
377
|
-
*
|
|
378
|
-
* @param
|
|
379
|
-
* @return {string}
|
|
368
|
+
* Renders a number in ordinal, such as 1st, 2nd or 3rd
|
|
369
|
+
* @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
|
|
380
370
|
*/
|
|
381
371
|
static ordinal(n, locale) {
|
|
382
372
|
const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
|
|
@@ -403,11 +393,6 @@ class Locale {
|
|
|
403
393
|
return n + '.';
|
|
404
394
|
}
|
|
405
395
|
}
|
|
406
|
-
/**
|
|
407
|
-
* @private
|
|
408
|
-
* @param {number} n
|
|
409
|
-
* @return {string}
|
|
410
|
-
*/
|
|
411
396
|
static getEnOrdinal(n) {
|
|
412
397
|
const s = ['th', 'st', 'nd', 'rd'];
|
|
413
398
|
const v = n % 100;
|
|
@@ -415,8 +400,6 @@ class Locale {
|
|
|
415
400
|
}
|
|
416
401
|
/**
|
|
417
402
|
* Removes nekudot from Hebrew string
|
|
418
|
-
* @param {string} str
|
|
419
|
-
* @return {string}
|
|
420
403
|
*/
|
|
421
404
|
static hebrewStripNikkud(str) {
|
|
422
405
|
return str.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
|
|
@@ -815,20 +798,30 @@ function getEventCategories(ev) {
|
|
|
815
798
|
function renderTitleWithoutTime(ev) {
|
|
816
799
|
return typeof ev.eventTime === 'undefined' ? ev.render() : ev.renderBrief();
|
|
817
800
|
}
|
|
801
|
+
function shortLocationName(options) {
|
|
802
|
+
const loc = options.location;
|
|
803
|
+
if (!loc) {
|
|
804
|
+
return null;
|
|
805
|
+
}
|
|
806
|
+
if (options.preferAsciiName) {
|
|
807
|
+
const asciiname = loc.asciiname;
|
|
808
|
+
if (typeof asciiname === 'string') {
|
|
809
|
+
return asciiname;
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
return loc.getShortName();
|
|
813
|
+
}
|
|
818
814
|
/**
|
|
819
815
|
* Generates a title like "Hebcal 2020 Israel" or "Hebcal May 1993 Providence"
|
|
820
816
|
*/
|
|
821
817
|
function getCalendarTitle(events, options) {
|
|
822
818
|
let title = 'Hebcal';
|
|
823
|
-
const
|
|
824
|
-
const locationName = location === null || location === void 0 ? void 0 : location.getName();
|
|
819
|
+
const locationName = shortLocationName(options);
|
|
825
820
|
if (options.yahrzeit) {
|
|
826
821
|
title += ' Yahrzeits and Anniversaries';
|
|
827
822
|
}
|
|
828
823
|
else if (locationName) {
|
|
829
|
-
|
|
830
|
-
const name = (comma == -1) ? locationName : locationName.substring(0, comma);
|
|
831
|
-
title += ' ' + name;
|
|
824
|
+
title += ' ' + locationName;
|
|
832
825
|
}
|
|
833
826
|
else if (options.il) {
|
|
834
827
|
title += ' Israel';
|
|
@@ -1142,9 +1135,9 @@ function eventToClassicApiObject(ev, options, leyning = true) {
|
|
|
1142
1135
|
if (reading) {
|
|
1143
1136
|
result.leyning = formatLeyningResult(reading);
|
|
1144
1137
|
const hyear = hd.getFullYear();
|
|
1145
|
-
if (isParsha &&
|
|
1146
|
-
const triReading = getTriennialForParshaHaShavua(ev);
|
|
1147
|
-
if (triReading) {
|
|
1138
|
+
if (isParsha && hyear >= 5745) {
|
|
1139
|
+
const triReading = getTriennialForParshaHaShavua(ev, il);
|
|
1140
|
+
if (triReading === null || triReading === void 0 ? void 0 : triReading.aliyot) {
|
|
1148
1141
|
result.leyning.triennial = formatAliyot({}, triReading.aliyot);
|
|
1149
1142
|
}
|
|
1150
1143
|
}
|
|
@@ -1217,6 +1210,18 @@ function formatAliyot(result, aliyot) {
|
|
|
1217
1210
|
}
|
|
1218
1211
|
return result;
|
|
1219
1212
|
}
|
|
1213
|
+
function formatReasons(result, reason) {
|
|
1214
|
+
for (const num of ['7', '8', 'M']) {
|
|
1215
|
+
if (reason[num]) {
|
|
1216
|
+
const k = num == 'M' ? 'maftir' : num;
|
|
1217
|
+
result[k] += ' | ' + reason[num];
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
if (reason.haftara) {
|
|
1221
|
+
result.haftarah += ' | ' + reason.haftara;
|
|
1222
|
+
}
|
|
1223
|
+
return result;
|
|
1224
|
+
}
|
|
1220
1225
|
function formatLeyningResult(reading) {
|
|
1221
1226
|
const result = {};
|
|
1222
1227
|
if (reading.summary) {
|
|
@@ -1232,15 +1237,7 @@ function formatLeyningResult(reading) {
|
|
|
1232
1237
|
formatAliyot(result, reading.fullkriyah);
|
|
1233
1238
|
}
|
|
1234
1239
|
if (reading.reason) {
|
|
1235
|
-
|
|
1236
|
-
if (reading.reason[num]) {
|
|
1237
|
-
const k = num == 'M' ? 'maftir' : num;
|
|
1238
|
-
result[k] += ' | ' + reading.reason[num];
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
|
-
if (reading.reason.haftara) {
|
|
1242
|
-
result.haftarah += ' | ' + reading.reason.haftara;
|
|
1243
|
-
}
|
|
1240
|
+
formatReasons(result, reading.reason);
|
|
1244
1241
|
}
|
|
1245
1242
|
return result;
|
|
1246
1243
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/rest-api",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.2",
|
|
4
4
|
"author": "Michael J. Radwin (https://github.com/mjradwin)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hebcal"
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"url": "https://github.com/hebcal/hebcal-rest-api/issues"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@hebcal/core": "^5.4.
|
|
33
|
-
"@hebcal/leyning": "^8.
|
|
34
|
-
"@hebcal/triennial": "^5.
|
|
32
|
+
"@hebcal/core": "^5.4.9",
|
|
33
|
+
"@hebcal/leyning": "^8.2.2",
|
|
34
|
+
"@hebcal/triennial": "^5.1.1"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build:rollup": "rollup -c",
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"build": "npm run build:json2js && npm run build:rollup",
|
|
40
40
|
"prepublish": "npm run build",
|
|
41
41
|
"pretest": "npm run build",
|
|
42
|
-
"
|
|
42
|
+
"docs": "typedoc",
|
|
43
43
|
"test": "jest"
|
|
44
44
|
},
|
|
45
45
|
"license": "BSD-2-Clause",
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@babel/preset-env": "^7.24.
|
|
47
|
+
"@babel/preset-env": "^7.24.8",
|
|
48
48
|
"@babel/preset-typescript": "^7.24.7",
|
|
49
|
-
"@hebcal/learning": "^5.
|
|
49
|
+
"@hebcal/learning": "^5.1.1",
|
|
50
50
|
"@rollup/plugin-commonjs": "^26.0.1",
|
|
51
51
|
"@rollup/plugin-json": "^6.1.0",
|
|
52
52
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
@@ -55,10 +55,9 @@
|
|
|
55
55
|
"@types/jest": "^29.5.12",
|
|
56
56
|
"gts": "^5.3.1",
|
|
57
57
|
"jest": "^29.7.0",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"ts-jest": "^29.1.5",
|
|
58
|
+
"rollup": "^4.18.1",
|
|
59
|
+
"ts-jest": "^29.2.2",
|
|
60
|
+
"typedoc": "^0.26.4",
|
|
62
61
|
"typescript": "^5.5.3"
|
|
63
62
|
}
|
|
64
63
|
}
|