@hebcal/leyning 8.2.6 → 8.2.8
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/dist/bundle.js +102 -74
- package/dist/bundle.min.js +2 -2
- package/dist/common.d.ts +9 -1
- package/dist/getLeyningOnDate.d.ts +2 -1
- package/dist/index.cjs +102 -74
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +102 -75
- package/dist/module.d.ts +12 -3
- package/package.json +12 -12
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/leyning v8.2.
|
|
1
|
+
/*! @hebcal/leyning v8.2.8 */
|
|
2
2
|
import { flags, months, HDate, HebrewCalendar, Locale, ParshaEvent, HolidayEvent, Event } from '@hebcal/core';
|
|
3
3
|
|
|
4
4
|
var numverses = {
|
|
@@ -53,7 +53,19 @@ var numverses = {
|
|
|
53
53
|
* Names of the books of the Torah. BOOK[1] === 'Genesis'
|
|
54
54
|
* @readonly
|
|
55
55
|
*/
|
|
56
|
-
const BOOK = [
|
|
56
|
+
const BOOK = [
|
|
57
|
+
'',
|
|
58
|
+
'Genesis',
|
|
59
|
+
'Exodus',
|
|
60
|
+
'Leviticus',
|
|
61
|
+
'Numbers',
|
|
62
|
+
'Deuteronomy',
|
|
63
|
+
];
|
|
64
|
+
/**
|
|
65
|
+
* The number of verses in each book of the Tanakh.
|
|
66
|
+
* @readonly
|
|
67
|
+
*/
|
|
68
|
+
const NUM_VERSES = numverses;
|
|
57
69
|
/**
|
|
58
70
|
* Formats parsha as a string
|
|
59
71
|
* @param parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
|
|
@@ -62,11 +74,13 @@ function parshaToString(parsha) {
|
|
|
62
74
|
if (typeof parsha === 'string') {
|
|
63
75
|
return parsha;
|
|
64
76
|
}
|
|
65
|
-
else if (!Array.isArray(parsha) ||
|
|
77
|
+
else if (!Array.isArray(parsha) ||
|
|
78
|
+
parsha.length === 0 ||
|
|
79
|
+
parsha.length > 2) {
|
|
66
80
|
throw new TypeError(`Bad parsha argument: ${parsha}`);
|
|
67
81
|
}
|
|
68
82
|
let s = parsha[0];
|
|
69
|
-
if (parsha.length
|
|
83
|
+
if (parsha.length === 2) {
|
|
70
84
|
s += '-' + parsha[1];
|
|
71
85
|
}
|
|
72
86
|
return s;
|
|
@@ -90,7 +104,7 @@ function calculateNumVerses(aliyah) {
|
|
|
90
104
|
aliyah.v = v2 - v1 + 1;
|
|
91
105
|
}
|
|
92
106
|
else if (typeof aliyah.k === 'string') {
|
|
93
|
-
const numv =
|
|
107
|
+
const numv = NUM_VERSES[aliyah.k];
|
|
94
108
|
if (typeof numv !== 'object' || !numv.length) {
|
|
95
109
|
throw new ReferenceError(`Can't find numverses for ${aliyah.k}`);
|
|
96
110
|
}
|
|
@@ -129,16 +143,16 @@ function formatAliyahShort(aliyah, showBook) {
|
|
|
129
143
|
* @private
|
|
130
144
|
*/
|
|
131
145
|
function isChapVerseBefore(a, b) {
|
|
132
|
-
const cv1 = a.split(':').map(
|
|
133
|
-
const cv2 = b.split(':').map(
|
|
134
|
-
return
|
|
146
|
+
const cv1 = a.split(':').map(x => +x);
|
|
147
|
+
const cv2 = b.split(':').map(x => +x);
|
|
148
|
+
return cv1[0] * 100 + cv1[1] < cv2[0] * 100 + cv2[1];
|
|
135
149
|
}
|
|
136
150
|
/**
|
|
137
151
|
* Summarizes an `AliyotMap` by collapsing all adjacent aliyot.
|
|
138
152
|
* Finds any non-overlapping parts (e.g. special 7th aliyah or maftir)
|
|
139
153
|
*/
|
|
140
154
|
function makeLeyningParts(aliyot) {
|
|
141
|
-
const nums = Object.keys(aliyot).filter(
|
|
155
|
+
const nums = Object.keys(aliyot).filter(x => {
|
|
142
156
|
if (x.length === 1) {
|
|
143
157
|
return true;
|
|
144
158
|
}
|
|
@@ -151,15 +165,17 @@ function makeLeyningParts(aliyot) {
|
|
|
151
165
|
for (let i = 0; i < nums.length; i++) {
|
|
152
166
|
const num = nums[i];
|
|
153
167
|
const aliyah = aliyot[num];
|
|
154
|
-
if (
|
|
168
|
+
if (i === nums.length - 1 && aliyah.k === end.k && aliyah.e === end.e) {
|
|
155
169
|
// short-circuit when final aliyah is within the previous (e.g. M inside of 7)
|
|
156
170
|
continue;
|
|
157
171
|
}
|
|
158
|
-
const prevEndChap = +
|
|
159
|
-
const curStartChap = +
|
|
172
|
+
const prevEndChap = +end.e.split(':')[0];
|
|
173
|
+
const curStartChap = +aliyah.b.split(':')[0];
|
|
160
174
|
const sameOrNextChap = curStartChap === prevEndChap || curStartChap === prevEndChap + 1;
|
|
161
|
-
if (
|
|
162
|
-
(aliyah.k !== start.k ||
|
|
175
|
+
if (i !== 0 &&
|
|
176
|
+
(aliyah.k !== start.k ||
|
|
177
|
+
isChapVerseBefore(aliyah.b, start.e) ||
|
|
178
|
+
!sameOrNextChap)) {
|
|
163
179
|
parts.push({ k: start.k, b: start.b, e: end.e });
|
|
164
180
|
start = aliyah;
|
|
165
181
|
}
|
|
@@ -225,7 +241,9 @@ function cloneHaftara(haft) {
|
|
|
225
241
|
* Returns the total number of verses in an array of Aliyah (or haftarah) objects
|
|
226
242
|
*/
|
|
227
243
|
function sumVerses(aliyot) {
|
|
228
|
-
return Array.isArray(aliyot)
|
|
244
|
+
return Array.isArray(aliyot)
|
|
245
|
+
? aliyot.reduce((prev, cur) => prev + cur.v, 0)
|
|
246
|
+
: aliyot.v;
|
|
229
247
|
}
|
|
230
248
|
|
|
231
249
|
var festivals0 = { "Pesach I": {
|
|
@@ -880,9 +898,15 @@ function lookupFestival(holiday) {
|
|
|
880
898
|
return result;
|
|
881
899
|
}
|
|
882
900
|
|
|
883
|
-
const HOLIDAY_IGNORE_MASK = flags.DAF_YOMI |
|
|
884
|
-
flags.
|
|
885
|
-
flags.
|
|
901
|
+
const HOLIDAY_IGNORE_MASK = flags.DAF_YOMI |
|
|
902
|
+
flags.OMER_COUNT |
|
|
903
|
+
flags.SHABBAT_MEVARCHIM |
|
|
904
|
+
flags.MOLAD |
|
|
905
|
+
flags.USER_EVENT |
|
|
906
|
+
flags.HEBREW_DATE |
|
|
907
|
+
flags.MISHNA_YOMI |
|
|
908
|
+
flags.MODERN_HOLIDAY |
|
|
909
|
+
flags.YERUSHALMI_YOMI;
|
|
886
910
|
/**
|
|
887
911
|
* Based on the event date, type and title, finds the relevant leyning key
|
|
888
912
|
* @param ev event
|
|
@@ -906,17 +930,19 @@ function getLeyningKeyForEvent(ev, il = false) {
|
|
|
906
930
|
const day = hd.getDate();
|
|
907
931
|
const dow = hd.abs() % 7;
|
|
908
932
|
const month = hd.getMonth();
|
|
909
|
-
const isShabbat =
|
|
910
|
-
const isRoshChodesh =
|
|
933
|
+
const isShabbat = dow === 6;
|
|
934
|
+
const isRoshChodesh = day === 1 || day === 30;
|
|
911
935
|
const holiday = ev.basename();
|
|
912
936
|
const isPesach = holiday === 'Pesach';
|
|
913
937
|
if (il && isPesach) {
|
|
914
938
|
if (isShabbat) {
|
|
915
|
-
return day === 15 || day === 21
|
|
939
|
+
return day === 15 || day === 21
|
|
940
|
+
? desc + ' (on Shabbat)'
|
|
941
|
+
: 'Pesach Shabbat Chol ha-Moed';
|
|
916
942
|
}
|
|
917
943
|
return desc;
|
|
918
944
|
}
|
|
919
|
-
if (day
|
|
945
|
+
if (day === 1 && month === months.TISHREI) {
|
|
920
946
|
return isShabbat ? 'Rosh Hashana I (on Shabbat)' : 'Rosh Hashana I';
|
|
921
947
|
}
|
|
922
948
|
const cholHaMoedDay = ev.cholHaMoedDay;
|
|
@@ -925,14 +951,14 @@ function getLeyningKeyForEvent(ev, il = false) {
|
|
|
925
951
|
if (isShabbat) {
|
|
926
952
|
return holiday + ' Shabbat Chol ha-Moed';
|
|
927
953
|
}
|
|
928
|
-
else if (desc
|
|
954
|
+
else if (desc === 'Sukkot VII (Hoshana Raba)') {
|
|
929
955
|
return 'Sukkot Final Day (Hoshana Raba)';
|
|
930
956
|
}
|
|
931
957
|
if (isPesach && cholHaMoedDay) {
|
|
932
|
-
if (dow === 0 && desc ===
|
|
958
|
+
if (dow === 0 && desc === "Pesach IV (CH''M)") {
|
|
933
959
|
return 'Pesach Chol ha-Moed Day 2 on Sunday';
|
|
934
960
|
}
|
|
935
|
-
else if (dow === 1 && desc ===
|
|
961
|
+
else if (dow === 1 && desc === "Pesach V (CH''M)") {
|
|
936
962
|
return 'Pesach Chol ha-Moed Day 3 on Monday';
|
|
937
963
|
}
|
|
938
964
|
}
|
|
@@ -943,8 +969,8 @@ function getLeyningKeyForEvent(ev, il = false) {
|
|
|
943
969
|
if (isShabbat && isRoshChodesh) {
|
|
944
970
|
return 'Shabbat Rosh Chodesh Chanukah';
|
|
945
971
|
}
|
|
946
|
-
else if (isRoshChodesh && chanukahDay
|
|
947
|
-
return
|
|
972
|
+
else if (isRoshChodesh && chanukahDay === 7) {
|
|
973
|
+
return 'Chanukah Day 7 (on Rosh Chodesh)';
|
|
948
974
|
}
|
|
949
975
|
else if (isShabbat) {
|
|
950
976
|
return `Chanukah Day ${chanukahDay} (on Shabbat)`;
|
|
@@ -953,16 +979,17 @@ function getLeyningKeyForEvent(ev, il = false) {
|
|
|
953
979
|
return `Chanukah Day ${chanukahDay}`;
|
|
954
980
|
}
|
|
955
981
|
}
|
|
956
|
-
if (isRoshChodesh &&
|
|
982
|
+
if (isRoshChodesh &&
|
|
983
|
+
(desc === 'Shabbat HaChodesh' || desc === 'Shabbat Shekalim')) {
|
|
957
984
|
return desc + ' (on Rosh Chodesh)';
|
|
958
985
|
}
|
|
959
|
-
if (il && desc
|
|
986
|
+
if (il && desc === 'Shmini Atzeret') {
|
|
960
987
|
return 'Simchat Torah';
|
|
961
988
|
}
|
|
962
989
|
if (desc === 'Chag HaBanot') {
|
|
963
990
|
return undefined;
|
|
964
991
|
}
|
|
965
|
-
if (isShabbat && 'Shabbat'
|
|
992
|
+
if (isShabbat && 'Shabbat' !== desc.substring(0, 7)) {
|
|
966
993
|
if (isRoshChodesh) {
|
|
967
994
|
if (desc === 'Rosh Chodesh Tevet') {
|
|
968
995
|
return 'Shabbat Rosh Chodesh Chanukah';
|
|
@@ -1000,8 +1027,8 @@ function getLeyningKeyForEvent(ev, il = false) {
|
|
|
1000
1027
|
if (isRoshChodesh) {
|
|
1001
1028
|
return desc;
|
|
1002
1029
|
}
|
|
1003
|
-
if (desc ===
|
|
1004
|
-
return
|
|
1030
|
+
if (desc === "Tish'a B'Av (observed)") {
|
|
1031
|
+
return "Tish'a B'Av";
|
|
1005
1032
|
}
|
|
1006
1033
|
return undefined;
|
|
1007
1034
|
}
|
|
@@ -1078,7 +1105,7 @@ function specialReadings2(parsha, hd, il, aliyot) {
|
|
|
1078
1105
|
}
|
|
1079
1106
|
const parshaName = parshaToString(parsha);
|
|
1080
1107
|
const events0 = HebrewCalendar.getHolidaysOnDate(hd, il) || [];
|
|
1081
|
-
const events = events0.filter(
|
|
1108
|
+
const events = events0.filter(ev => !(ev.getFlags() & flags.ROSH_CHODESH));
|
|
1082
1109
|
for (const ev of events) {
|
|
1083
1110
|
if (ev.getDesc() === 'Shabbat Shuva') {
|
|
1084
1111
|
handleSpecial(`Shabbat Shuva (with ${parshaName})`);
|
|
@@ -1098,9 +1125,9 @@ function specialReadings2(parsha, hd, il, aliyot) {
|
|
|
1098
1125
|
handleSpecial('Pinchas occurring after 17 Tammuz');
|
|
1099
1126
|
}
|
|
1100
1127
|
else if (day === 30 || day === 1) {
|
|
1101
|
-
const key =
|
|
1102
|
-
`${parshaName} on Shabbat Rosh Chodesh`
|
|
1103
|
-
'Shabbat Rosh Chodesh';
|
|
1128
|
+
const key = parshaName === 'Masei' || parshaName === 'Matot-Masei'
|
|
1129
|
+
? `${parshaName} on Shabbat Rosh Chodesh`
|
|
1130
|
+
: 'Shabbat Rosh Chodesh';
|
|
1104
1131
|
handleSpecial(key);
|
|
1105
1132
|
}
|
|
1106
1133
|
else if (parshaName === 'Ki Teitzei' && day === 14) {
|
|
@@ -1112,7 +1139,8 @@ function specialReadings2(parsha, hd, il, aliyot) {
|
|
|
1112
1139
|
// Source: Luaḥ Hashanah, Rabbi Miles B. Cohen and Leslie Rubin
|
|
1113
1140
|
handleSpecial('Ki Teitzei with 3rd Haftarah of Consolation');
|
|
1114
1141
|
}
|
|
1115
|
-
else if (parshaName === 'Kedoshim' &&
|
|
1142
|
+
else if (parshaName === 'Kedoshim' &&
|
|
1143
|
+
(day === 26 || day === 28 || day === 6)) {
|
|
1116
1144
|
// Kedoshim is read separately from Achrei Mot in ~37% of years.
|
|
1117
1145
|
// When this happens, it is will be read on
|
|
1118
1146
|
// 26th or 28th of Nisan (Achrei Mot was Shabbat HaGadol, ~10%),
|
|
@@ -1152,7 +1180,9 @@ function getLeyningForHolidayKey(key, cholHaMoedDay, il) {
|
|
|
1152
1180
|
return undefined;
|
|
1153
1181
|
}
|
|
1154
1182
|
const israelOnly = src.il;
|
|
1155
|
-
if (typeof israelOnly === 'boolean' &&
|
|
1183
|
+
if (typeof israelOnly === 'boolean' &&
|
|
1184
|
+
typeof il === 'boolean' &&
|
|
1185
|
+
il !== israelOnly) {
|
|
1156
1186
|
return undefined;
|
|
1157
1187
|
}
|
|
1158
1188
|
const leyning = {
|
|
@@ -1176,21 +1206,21 @@ function getLeyningForHolidayKey(key, cholHaMoedDay, il) {
|
|
|
1176
1206
|
leyning.summaryParts = parts;
|
|
1177
1207
|
}
|
|
1178
1208
|
}
|
|
1179
|
-
Object.values(leyning.fullkriyah).map(
|
|
1209
|
+
Object.values(leyning.fullkriyah).map(aliyah => calculateNumVerses(aliyah));
|
|
1180
1210
|
}
|
|
1181
1211
|
if (src.haft) {
|
|
1182
|
-
const haft = leyning.haft = cloneHaftara(src.haft);
|
|
1212
|
+
const haft = (leyning.haft = cloneHaftara(src.haft));
|
|
1183
1213
|
leyning.haftara = makeSummaryFromParts(haft);
|
|
1184
1214
|
leyning.haftaraNumV = sumVerses(haft);
|
|
1185
1215
|
}
|
|
1186
1216
|
if (src.seph) {
|
|
1187
|
-
const seph = leyning.seph = cloneHaftara(src.seph);
|
|
1217
|
+
const seph = (leyning.seph = cloneHaftara(src.seph));
|
|
1188
1218
|
leyning.sephardic = makeSummaryFromParts(seph);
|
|
1189
1219
|
leyning.sephardicNumV = sumVerses(seph);
|
|
1190
1220
|
}
|
|
1191
1221
|
if (src.megillah) {
|
|
1192
1222
|
const book = src.megillah;
|
|
1193
|
-
const chaps =
|
|
1223
|
+
const chaps = NUM_VERSES[book];
|
|
1194
1224
|
const m = {};
|
|
1195
1225
|
for (let i = 1; i < chaps.length; i++) {
|
|
1196
1226
|
const numv = chaps[i];
|
|
@@ -2522,10 +2552,10 @@ const parshiyotObj = parshiyotObj0;
|
|
|
2522
2552
|
*/
|
|
2523
2553
|
function getHaftaraKey(parsha) {
|
|
2524
2554
|
const first = parsha[0];
|
|
2525
|
-
if (parsha.length === 2 && first
|
|
2555
|
+
if (parsha.length === 2 && first === 'Achrei Mot') {
|
|
2526
2556
|
return parshaToString(parsha); // 'Achrei Mot-Kedoshim'
|
|
2527
2557
|
}
|
|
2528
|
-
if (parsha.length === 1 || first
|
|
2558
|
+
if (parsha.length === 1 || first === 'Nitzavim') {
|
|
2529
2559
|
return first;
|
|
2530
2560
|
}
|
|
2531
2561
|
else {
|
|
@@ -2540,7 +2570,7 @@ function makeLeyningNames(parsha) {
|
|
|
2540
2570
|
const name = parshaToString(parsha);
|
|
2541
2571
|
return {
|
|
2542
2572
|
en: name,
|
|
2543
|
-
he: parsha.map(
|
|
2573
|
+
he: parsha.map(s => Locale.lookupTranslation(s, 'he')).join('־'),
|
|
2544
2574
|
};
|
|
2545
2575
|
}
|
|
2546
2576
|
/**
|
|
@@ -2577,13 +2607,13 @@ function getLeyningForParshaShabbatOnly(parsha) {
|
|
|
2577
2607
|
const hkey = getHaftaraKey(parshaNameArray);
|
|
2578
2608
|
const haft0 = parshiyotObj[hkey].haft;
|
|
2579
2609
|
if (haft0) {
|
|
2580
|
-
const haft = result.haft = cloneHaftara(haft0);
|
|
2610
|
+
const haft = (result.haft = cloneHaftara(haft0));
|
|
2581
2611
|
result.haftara = makeSummaryFromParts(haft);
|
|
2582
2612
|
result.haftaraNumV = sumVerses(haft);
|
|
2583
2613
|
}
|
|
2584
2614
|
const seph0 = parshiyotObj[hkey].seph;
|
|
2585
2615
|
if (seph0) {
|
|
2586
|
-
const seph = result.seph = cloneHaftara(seph0);
|
|
2616
|
+
const seph = (result.seph = cloneHaftara(seph0));
|
|
2587
2617
|
result.sephardic = makeSummaryFromParts(seph);
|
|
2588
2618
|
result.sephardicNumV = sumVerses(seph);
|
|
2589
2619
|
}
|
|
@@ -2631,7 +2661,7 @@ function getLeyningForParshaHaShavua(ev, il = false) {
|
|
|
2631
2661
|
if (typeof ev !== 'object' || typeof ev.getFlags !== 'function') {
|
|
2632
2662
|
throw new TypeError(`Bad event argument: ${ev}`);
|
|
2633
2663
|
}
|
|
2634
|
-
else if (ev.getFlags()
|
|
2664
|
+
else if (ev.getFlags() !== flags.PARSHA_HASHAVUA) {
|
|
2635
2665
|
throw new TypeError(`Event must be parsha hashavua: ${ev.getDesc()}`);
|
|
2636
2666
|
}
|
|
2637
2667
|
// first, collect the default aliyot and haftara
|
|
@@ -2642,11 +2672,11 @@ function getLeyningForParshaHaShavua(ev, il = false) {
|
|
|
2642
2672
|
const special = specialReadings2(parsha, hd, il, result.fullkriyah);
|
|
2643
2673
|
const reason = special.reason;
|
|
2644
2674
|
if (special.haft) {
|
|
2645
|
-
const haft = result.haft = cloneHaftara(special.haft);
|
|
2675
|
+
const haft = (result.haft = cloneHaftara(special.haft));
|
|
2646
2676
|
result.haftara = makeSummaryFromParts(haft);
|
|
2647
2677
|
result.haftaraNumV = sumVerses(haft);
|
|
2648
2678
|
if (special.seph) {
|
|
2649
|
-
const seph = result.seph = cloneHaftara(special.seph);
|
|
2679
|
+
const seph = (result.seph = cloneHaftara(special.seph));
|
|
2650
2680
|
result.sephardic = makeSummaryFromParts(seph);
|
|
2651
2681
|
result.sephardicNumV = sumVerses(seph);
|
|
2652
2682
|
}
|
|
@@ -2741,23 +2771,6 @@ function findParshaHaShavua(saturday, il) {
|
|
|
2741
2771
|
/* NOTREACHED */
|
|
2742
2772
|
throw new Error(`can't findParshaHaShavua for ${saturday}/${il}`);
|
|
2743
2773
|
}
|
|
2744
|
-
/**
|
|
2745
|
-
* Looks up leyning for a regular Shabbat, Monday/Thursday weekday or holiday.
|
|
2746
|
-
*
|
|
2747
|
-
* If `hdate` coincides with a holiday that has Torah reading, returns the
|
|
2748
|
-
* reading for that day (see {@link getLeyningForHoliday})
|
|
2749
|
-
*
|
|
2750
|
-
* Otherwise, if `hdate` is a Saturday, returns {@link getLeyningForParshaHaShavua}
|
|
2751
|
-
*
|
|
2752
|
-
* Otherwise, if `hdate` is a Monday or Thursday, returns {@link Leyning} for the
|
|
2753
|
-
* Parashat haShavua, containing only the `weekday` aliyot (no `fullkriyah`).
|
|
2754
|
-
*
|
|
2755
|
-
* Otherwise, returns `undefined`.
|
|
2756
|
-
*
|
|
2757
|
-
* @param {HDate} hdate Hebrew Date
|
|
2758
|
-
* @param {boolean} il in Israel
|
|
2759
|
-
* @param {boolean} [wantarray] to return an array of 0 or more readings
|
|
2760
|
-
*/
|
|
2761
2774
|
function getLeyningOnDate(hdate, il, wantarray = false) {
|
|
2762
2775
|
const dow = hdate.getDay();
|
|
2763
2776
|
const arr = [];
|
|
@@ -2787,6 +2800,9 @@ function getLeyningOnDate(hdate, il, wantarray = false) {
|
|
|
2787
2800
|
}
|
|
2788
2801
|
const reading = getLeyningForHoliday(ev, il);
|
|
2789
2802
|
if (reading) {
|
|
2803
|
+
// Skip duplicate readings from overlapping events (eg, Rosh Chodesh + Chanukah)
|
|
2804
|
+
if (arr.some(r => r.name.en === reading.name.en))
|
|
2805
|
+
continue;
|
|
2790
2806
|
const fk = reading.fullkriyah;
|
|
2791
2807
|
if (fk) {
|
|
2792
2808
|
hasFullKriyah = true;
|
|
@@ -2842,14 +2858,16 @@ function getMincha(ev, il) {
|
|
|
2842
2858
|
}
|
|
2843
2859
|
|
|
2844
2860
|
const fmt = new Intl.DateTimeFormat('en-US', {
|
|
2845
|
-
year: 'numeric',
|
|
2861
|
+
year: 'numeric',
|
|
2862
|
+
month: 'short',
|
|
2863
|
+
day: '2-digit',
|
|
2846
2864
|
});
|
|
2847
2865
|
function fmtDate(dt) {
|
|
2848
2866
|
const s = fmt.format(dt).split(' ');
|
|
2849
2867
|
return s[1].substring(0, 2) + '-' + s[0] + '-' + s[2];
|
|
2850
2868
|
}
|
|
2851
2869
|
function getParshaDates(events) {
|
|
2852
|
-
const parshaEvents = events.filter(
|
|
2870
|
+
const parshaEvents = events.filter(ev => ev.getFlags() === flags.PARSHA_HASHAVUA);
|
|
2853
2871
|
const emptyMap = {};
|
|
2854
2872
|
const parshaDates = parshaEvents.reduce((set, ev) => {
|
|
2855
2873
|
set[ev.getDate().toString()] = true;
|
|
@@ -2868,7 +2886,8 @@ function writeFullKriyahCsv(stream, hyear, il) {
|
|
|
2868
2886
|
const parshaDates = getParshaDates(events);
|
|
2869
2887
|
stream.write('"Date","Parashah","Aliyah","Reading","Verses"\r\n');
|
|
2870
2888
|
for (const ev of events) {
|
|
2871
|
-
if (ev.getFlags() === flags.PARSHA_HASHAVUA ||
|
|
2889
|
+
if (ev.getFlags() === flags.PARSHA_HASHAVUA ||
|
|
2890
|
+
!parshaDates[ev.getDate().toString()]) {
|
|
2872
2891
|
writeFullKriyahEvent(stream, ev, il);
|
|
2873
2892
|
}
|
|
2874
2893
|
}
|
|
@@ -2889,7 +2908,9 @@ function writeFullKriyahEvent(stream, ev, il) {
|
|
|
2889
2908
|
}
|
|
2890
2909
|
const mask = ev.getFlags();
|
|
2891
2910
|
const isParsha = mask === flags.PARSHA_HASHAVUA;
|
|
2892
|
-
const reading = isParsha
|
|
2911
|
+
const reading = isParsha
|
|
2912
|
+
? getLeyningForParshaHaShavua(ev, il)
|
|
2913
|
+
: getLeyningForHoliday(ev, il);
|
|
2893
2914
|
if (reading) {
|
|
2894
2915
|
writeCsvLines(stream, ev, reading, il, isParsha);
|
|
2895
2916
|
if (!isParsha) {
|
|
@@ -2918,7 +2939,9 @@ function writeHolidayMincha(stream, ev, il) {
|
|
|
2918
2939
|
* Formats reading for CSV
|
|
2919
2940
|
*/
|
|
2920
2941
|
function writeCsvLines(stream, ev, reading, il, isParsha) {
|
|
2921
|
-
const parsha = isParsha
|
|
2942
|
+
const parsha = isParsha
|
|
2943
|
+
? ev.basename()
|
|
2944
|
+
: getLeyningKeyForEvent(ev, il) || ev.render();
|
|
2922
2945
|
const date = fmtDate(ev.getDate().greg());
|
|
2923
2946
|
const lines = getFullKriyahLines(reading);
|
|
2924
2947
|
for (const s of lines) {
|
|
@@ -2936,7 +2959,7 @@ function getFullKriyahLines(reading) {
|
|
|
2936
2959
|
if (reading.fullkriyah) {
|
|
2937
2960
|
for (const [num, a] of Object.entries(reading.fullkriyah)) {
|
|
2938
2961
|
if (typeof a !== 'undefined') {
|
|
2939
|
-
const k = num
|
|
2962
|
+
const k = num === 'M' ? 'maf' : num;
|
|
2940
2963
|
let aliyah = formatAliyahWithBook(a);
|
|
2941
2964
|
if ((_a = reading.reason) === null || _a === void 0 ? void 0 : _a[num]) {
|
|
2942
2965
|
aliyah += ' | ' + reading.reason[num];
|
|
@@ -2958,7 +2981,11 @@ function getFullKriyahLines(reading) {
|
|
|
2958
2981
|
if ((_c = reading.reason) === null || _c === void 0 ? void 0 : _c.sephardic) {
|
|
2959
2982
|
sephardic += ' | ' + reading.reason.sephardic;
|
|
2960
2983
|
}
|
|
2961
|
-
lines.push([
|
|
2984
|
+
lines.push([
|
|
2985
|
+
'Haftara for Sephardim',
|
|
2986
|
+
sephardic,
|
|
2987
|
+
reading.sephardicNumV || '',
|
|
2988
|
+
]);
|
|
2962
2989
|
}
|
|
2963
2990
|
if (reading.triHaftara) {
|
|
2964
2991
|
const haftara = reading.triHaftara.replace(/,/g, ';');
|
|
@@ -2975,4 +3002,4 @@ function getFullKriyahLines(reading) {
|
|
|
2975
3002
|
return lines;
|
|
2976
3003
|
}
|
|
2977
3004
|
|
|
2978
|
-
export { BOOK, calculateNumVerses, clone, cloneHaftara, formatAliyahShort, formatAliyahWithBook, getLeyningForHoliday, getLeyningForHolidayKey, getLeyningForParsha, getLeyningForParshaHaShavua, getLeyningKeyForEvent, getLeyningOnDate, getParshaDates, getWeekdayReading, hasFestival, lookupFestival, lookupParsha, makeLeyningNames, makeLeyningParts, makeLeyningSummary, makeSummaryFromParts, parshaToString, specialReadings2, sumVerses, writeCsvLines, writeFullKriyahCsv, writeHolidayMincha };
|
|
3005
|
+
export { BOOK, NUM_VERSES, calculateNumVerses, clone, cloneHaftara, formatAliyahShort, formatAliyahWithBook, getLeyningForHoliday, getLeyningForHolidayKey, getLeyningForParsha, getLeyningForParshaHaShavua, getLeyningKeyForEvent, getLeyningOnDate, getParshaDates, getWeekdayReading, hasFestival, lookupFestival, lookupParsha, makeLeyningNames, makeLeyningParts, makeLeyningSummary, makeSummaryFromParts, parshaToString, specialReadings2, sumVerses, writeCsvLines, writeFullKriyahCsv, writeHolidayMincha };
|
package/dist/module.d.ts
CHANGED
|
@@ -136,7 +136,15 @@ type Leyning = LeyningBase & LeyningParshaHaShavua & LeyningShabbatHoliday & Ley
|
|
|
136
136
|
* Names of the books of the Torah. BOOK[1] === 'Genesis'
|
|
137
137
|
* @readonly
|
|
138
138
|
*/
|
|
139
|
-
declare const BOOK:
|
|
139
|
+
declare const BOOK: readonly ["", "Genesis", "Exodus", "Leviticus", "Numbers", "Deuteronomy"];
|
|
140
|
+
/**
|
|
141
|
+
* The number of verses in each book of the Tanakh.
|
|
142
|
+
* @readonly
|
|
143
|
+
*/
|
|
144
|
+
declare const NUM_VERSES: NumVerses;
|
|
145
|
+
type NumVerses = {
|
|
146
|
+
readonly [book: string]: readonly number[];
|
|
147
|
+
};
|
|
140
148
|
/**
|
|
141
149
|
* Formats parsha as a string
|
|
142
150
|
* @param parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
|
|
@@ -289,7 +297,8 @@ declare function lookupParsha(parsha: string | string[]): ParshaMeta;
|
|
|
289
297
|
* @param {boolean} il in Israel
|
|
290
298
|
* @param {boolean} [wantarray] to return an array of 0 or more readings
|
|
291
299
|
*/
|
|
292
|
-
declare function getLeyningOnDate(hdate: HDate, il: boolean, wantarray?:
|
|
300
|
+
declare function getLeyningOnDate(hdate: HDate, il: boolean, wantarray?: false): Leyning | LeyningWeekday | undefined;
|
|
301
|
+
declare function getLeyningOnDate(hdate: HDate, il: boolean, wantarray: true): (Leyning | LeyningWeekday)[];
|
|
293
302
|
|
|
294
303
|
interface StringToBoolMap {
|
|
295
304
|
[key: string]: boolean;
|
|
@@ -313,4 +322,4 @@ declare function cloneHaftara(haft: Haftarah): Aliyah | Aliyah[];
|
|
|
313
322
|
*/
|
|
314
323
|
declare function sumVerses(aliyot: Haftarah): number;
|
|
315
324
|
|
|
316
|
-
export { type Aliyah, type AliyotMap, BOOK, type Haftarah, type HaftarahProps, type Leyning, type LeyningBase, type LeyningNames, type LeyningParshaHaShavua, type LeyningShabbatHoliday, type LeyningWeekday, type ParshaMeta, type SpecialReading, type StringMap, type StringToBoolMap, calculateNumVerses, clone, cloneHaftara, formatAliyahShort, formatAliyahWithBook, getLeyningForHoliday, getLeyningForHolidayKey, getLeyningForParsha, getLeyningForParshaHaShavua, getLeyningKeyForEvent, getLeyningOnDate, getParshaDates, getWeekdayReading, hasFestival, lookupFestival, lookupParsha, makeLeyningNames, makeLeyningParts, makeLeyningSummary, makeSummaryFromParts, parshaToString, specialReadings2, sumVerses, writeCsvLines, writeFullKriyahCsv, writeHolidayMincha };
|
|
325
|
+
export { type Aliyah, type AliyotMap, BOOK, type Haftarah, type HaftarahProps, type Leyning, type LeyningBase, type LeyningNames, type LeyningParshaHaShavua, type LeyningShabbatHoliday, type LeyningWeekday, NUM_VERSES, type NumVerses, type ParshaMeta, type SpecialReading, type StringMap, type StringToBoolMap, calculateNumVerses, clone, cloneHaftara, formatAliyahShort, formatAliyahWithBook, getLeyningForHoliday, getLeyningForHolidayKey, getLeyningForParsha, getLeyningForParshaHaShavua, getLeyningKeyForEvent, getLeyningOnDate, getParshaDates, getWeekdayReading, hasFestival, lookupFestival, lookupParsha, makeLeyningNames, makeLeyningParts, makeLeyningSummary, makeSummaryFromParts, parshaToString, specialReadings2, sumVerses, writeCsvLines, writeFullKriyahCsv, writeHolidayMincha };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/leyning",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.8",
|
|
4
4
|
"author": "Michael J. Radwin (https://github.com/mjradwin)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hebcal",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@hebcal/core": "^5.5.2",
|
|
44
|
-
"tslib": "^2.
|
|
44
|
+
"tslib": "^2.8.0"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build:rollup": "rollup -c",
|
|
@@ -58,21 +58,21 @@
|
|
|
58
58
|
},
|
|
59
59
|
"license": "BSD-2-Clause",
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@babel/preset-env": "^7.
|
|
62
|
-
"@babel/preset-typescript": "^7.
|
|
63
|
-
"@rollup/plugin-commonjs": "^28.0.
|
|
61
|
+
"@babel/preset-env": "^7.26.0",
|
|
62
|
+
"@babel/preset-typescript": "^7.26.0",
|
|
63
|
+
"@rollup/plugin-commonjs": "^28.0.1",
|
|
64
64
|
"@rollup/plugin-json": "^6.1.0",
|
|
65
65
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
66
66
|
"@rollup/plugin-terser": "^0.4.4",
|
|
67
|
-
"@rollup/plugin-typescript": "^12.1.
|
|
68
|
-
"@types/jest": "^29.5.
|
|
69
|
-
"@types/node": "^22.
|
|
70
|
-
"gts": "^
|
|
67
|
+
"@rollup/plugin-typescript": "^12.1.1",
|
|
68
|
+
"@types/jest": "^29.5.14",
|
|
69
|
+
"@types/node": "^22.8.4",
|
|
70
|
+
"gts": "^6.0.2",
|
|
71
71
|
"jest": "^29.7.0",
|
|
72
|
-
"rollup": "^4.24.
|
|
72
|
+
"rollup": "^4.24.3",
|
|
73
73
|
"rollup-plugin-dts": "^6.1.1",
|
|
74
74
|
"ts-jest": "^29.2.5",
|
|
75
|
-
"typedoc": "^0.26.
|
|
76
|
-
"typescript": "^5.6.
|
|
75
|
+
"typedoc": "^0.26.10",
|
|
76
|
+
"typescript": "^5.6.3"
|
|
77
77
|
}
|
|
78
78
|
}
|