@hebcal/leyning 8.2.7 → 8.2.9

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/index.cjs CHANGED
@@ -1,8 +1,23 @@
1
- /*! @hebcal/leyning v8.2.7 */
1
+ /*! @hebcal/leyning v8.2.9 */
2
2
  'use strict';
3
3
 
4
4
  var core = require('@hebcal/core');
5
5
 
6
+ var poHe = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);" }, "contexts": { "": { "Shabbat Machar Chodesh": ["שַׁבָּת מָחָר חוֹדֶשׁ"], "Shabbat Rosh Chodesh": ["שַׁבָּת רֹאשׁ חוֹדֶשׁ"], "Pesach I (on Shabbat)": ["פֶּסַח יוֹם א׳ (בְּשַׁבָּת)"], "Pesach Chol ha-Moed Day 1": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם א׳"], "Pesach Chol ha-Moed Day 2": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ב׳"], "Pesach Chol ha-Moed Day 2 on Sunday": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ב׳ (בְּיוֹם רִאשׁוֹן)"], "Pesach Chol ha-Moed Day 3": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ג׳"], "Pesach Chol ha-Moed Day 3 on Monday": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ג׳ (בְּיוֹם שָׁנִי)"], "Pesach Chol ha-Moed Day 4": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ד׳"], "Pesach Chol ha-Moed Day 5": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ה׳"], "Pesach Shabbat Chol ha-Moed": ["פֶּסַח שַׁבָּת חוֹל הַמּוֹעֵד"], "Pesach VII (on Shabbat)": ["פֶּסַח ז׳ (בְּשַׁבָּת)"], "Pesach VIII (on Shabbat)": ["פֶּסַח ח׳ (בְּשַׁבָּת)"], "Shavuot II (on Shabbat)": ["שָׁבוּעוֹת יוֹם ב׳ (בְּשַׁבָּת)"], "Rosh Hashana I (on Shabbat)": ["רֹאשׁ הַשָּׁנָה יוֹם א׳ (בְּשַׁבָּת)"], "Yom Kippur (on Shabbat)": ["יוֹם כִּפּוּר (בְּשַׁבָּת)"], "Yom Kippur (Mincha, Traditional)": ["יוֹם כִּפּוּר מִנחָה"], "Yom Kippur (Mincha, Alternate)": ["יוֹם כִּפּוּר מִנחָה"], "Sukkot I (on Shabbat)": ["סוּכּוֹת יוֹם א׳ (בְּשַׁבָּת)"], "Sukkot Chol ha-Moed Day 1": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם א׳"], "Sukkot Chol ha-Moed Day 2": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ב׳"], "Sukkot Chol ha-Moed Day 3": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ג׳"], "Sukkot Chol ha-Moed Day 4": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ד׳"], "Sukkot Chol ha-Moed Day 5": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ה׳"], "Sukkot Shabbat Chol ha-Moed": ["סוּכּוֹת שַׁבָּת חוֹל הַמּוֹעֵד"], "Sukkot Final Day (Hoshana Raba)": ["סוּכּוֹת ז׳ (הוֹשַׁעְנָא רַבָּה)"], "Shmini Atzeret (on Shabbat)": ["שְׁמִינִי עֲצֶרֶת (בְּשַׁבָּת)"], "Chanukah Day 1": ["חֲנוּכָּה יוֹם א׳"], "Chanukah Day 2": ["חֲנוּכָּה יוֹם ב׳"], "Chanukah Day 3": ["חֲנוּכָּה יוֹם ג׳"], "Chanukah Day 4": ["חֲנוּכָּה יוֹם ד׳"], "Chanukah Day 5": ["חֲנוּכָּה יוֹם ה׳"], "Chanukah Day 6": ["חֲנוּכָּה יוֹם ו׳"], "Chanukah Day 7": ["חֲנוּכָּה יוֹם ז׳"], "Chanukah Day 7 (on Rosh Chodesh)": ["חֲנוּכָּה יוֹם ז׳ (רֹאשׁ חוֹדֶשׁ)"], "Chanukah Day 8": ["חֲנוּכָּה יוֹם ח׳"], "Chanukah Day 1 (on Shabbat)": ["חֲנוּכָּה יוֹם א׳ (בְּשַׁבָּת)"], "Chanukah Day 2 (on Shabbat)": ["חֲנוּכָּה יוֹם ב׳ (בְּשַׁבָּת)"], "Chanukah Day 3 (on Shabbat)": ["חֲנוּכָּה יוֹם ג׳ (בְּשַׁבָּת)"], "Chanukah Day 4 (on Shabbat)": ["חֲנוּכָּה יוֹם ד׳ (בְּשַׁבָּת)"], "Chanukah Day 5 (on Shabbat)": ["חֲנוּכָּה יוֹם ה׳ (בְּשַׁבָּת)"], "Chanukah Day 7 (on Shabbat)": ["חֲנוּכָּה יוֹם ז׳ (בְּשַׁבָּת)"], "Chanukah Day 8 (on Shabbat)": ["חֲנוּכָּה יוֹם ח׳ (בְּשַׁבָּת)"], "Shabbat Rosh Chodesh Chanukah": ["שַׁבָּת רֹאשׁ חוֹדֶשׁ חֲנוּכָּה"], "Yom Kippur (Mincha)": ["יוֹם כִּפּוּר מִנחָה"], "Tish'a B'Av (Mincha)": ["תִּשְׁעָה בְּאָב מִנחָה"], "Asara B'Tevet (Mincha)": ["עֲשָׂרָה בְּטֵבֵת מִנחָה"], "Ta'anit Bechorot (Mincha)": ["תַּעֲנִית בְּכוֹרוֹת מִנחָה"], "Ta'anit Esther (Mincha)": ["תַּעֲנִית אֶסְתֵּר מִנחָה"], "Tzom Gedaliah (Mincha)": ["צוֹם גְּדַלְיָה מִנחָה"], "Tzom Tammuz (Mincha)": ["צוֹם תָּמוּז מִנחָה"] } } };
7
+
8
+ core.Locale.addTranslations('he', poHe);
9
+ core.Locale.addTranslations('h', poHe);
10
+ const heStrs = poHe.contexts[''];
11
+ const heNoNikud = {};
12
+ for (const [key, val] of Object.entries(heStrs)) {
13
+ heNoNikud[key] = [core.Locale.hebrewStripNikkud(val[0])];
14
+ }
15
+ const poHeNoNikud = {
16
+ headers: poHe.headers,
17
+ contexts: { '': heNoNikud },
18
+ };
19
+ core.Locale.addTranslations('he-x-NoNikud', poHeNoNikud);
20
+
6
21
  var numverses = {
7
22
  "Genesis": [0,
8
23
  31, 25, 24, 26, 32, 22, 24, 22, 29, 32, 32, 20, 18, 24, 21, 16, 27, 33,
@@ -63,6 +78,11 @@ const BOOK = [
63
78
  'Numbers',
64
79
  'Deuteronomy',
65
80
  ];
81
+ /**
82
+ * The number of verses in each book of the Tanakh.
83
+ * @readonly
84
+ */
85
+ const NUM_VERSES = numverses;
66
86
  /**
67
87
  * Formats parsha as a string
68
88
  * @param parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
@@ -77,7 +97,7 @@ function parshaToString(parsha) {
77
97
  throw new TypeError(`Bad parsha argument: ${parsha}`);
78
98
  }
79
99
  let s = parsha[0];
80
- if (parsha.length == 2) {
100
+ if (parsha.length === 2) {
81
101
  s += '-' + parsha[1];
82
102
  }
83
103
  return s;
@@ -101,7 +121,7 @@ function calculateNumVerses(aliyah) {
101
121
  aliyah.v = v2 - v1 + 1;
102
122
  }
103
123
  else if (typeof aliyah.k === 'string') {
104
- const numv = numverses[aliyah.k];
124
+ const numv = NUM_VERSES[aliyah.k];
105
125
  if (typeof numv !== 'object' || !numv.length) {
106
126
  throw new ReferenceError(`Can't find numverses for ${aliyah.k}`);
107
127
  }
@@ -343,6 +363,7 @@ var festivals0 = { "Pesach I": {
343
363
  "M": { "p": 41, "k": 4, "b": "28:19", "e": "28:25" } }
344
364
  },
345
365
  "Pesach VII (on Shabbat)": {
366
+ "megillah": "Song of Songs",
346
367
  "haft": { "k": "II Samuel", "b": "22:1", "e": "22:51" },
347
368
  "fullkriyah": { "1": { "p": 16, "k": 2, "b": "13:17", "e": "13:19" },
348
369
  "2": { "p": 16, "k": 2, "b": "13:20", "e": "13:22" },
@@ -363,6 +384,7 @@ var festivals0 = { "Pesach I": {
363
384
  "M": { "p": 41, "k": 4, "b": "28:19", "e": "28:25" } }
364
385
  },
365
386
  "Pesach VIII (on Shabbat)": {
387
+ "megillah": "Song of Songs",
366
388
  "haft": { "k": "Isaiah", "b": "10:32", "e": "12:6" },
367
389
  "fullkriyah": { "1": { "p": 47, "k": 5, "b": "14:22", "e": "14:29" },
368
390
  "2": { "p": 47, "k": 5, "b": "15:1", "e": "15:18" },
@@ -612,6 +634,7 @@ var festivals0 = { "Pesach I": {
612
634
  "M": { "p": 41, "k": 4, "b": "29:35", "e": "30:1" } }
613
635
  },
614
636
  "Shmini Atzeret (on Shabbat)": {
637
+ "megillah": "Ecclesiastes",
615
638
  "haft": { "k": "I Kings", "b": "8:54", "e": "8:66" },
616
639
  "fullkriyah": { "1": { "p": 47, "k": 5, "b": "14:22", "e": "14:29" },
617
640
  "2": { "p": 47, "k": 5, "b": "15:1", "e": "15:18" },
@@ -638,6 +661,19 @@ var festivals0 = { "Pesach I": {
638
661
  "7": { "p": 1, "k": 1, "b": "1:1", "e": "2:3" },
639
662
  "M": { "p": 41, "k": 4, "b": "29:35", "e": "30:1" } }
640
663
  },
664
+ "Simchat Torah (on Shabbat)": {
665
+ "megillah": "Ecclesiastes",
666
+ "haft": { "k": "Joshua", "b": "1:1", "e": "1:18" },
667
+ "fullkriyah": { "1": { "p": 54, "k": 5, "b": "33:1", "e": "33:7" },
668
+ "2": { "p": 54, "k": 5, "b": "33:8", "e": "33:12" },
669
+ "3": { "p": 54, "k": 5, "b": "33:13", "e": "33:17" },
670
+ "4": { "p": 54, "k": 5, "b": "33:18", "e": "33:21" },
671
+ "5": { "p": 54, "k": 5, "b": "33:22", "e": "33:26" },
672
+ "6": { "p": 54, "k": 5, "b": "33:27", "e": "33:29" },
673
+ "7": { "p": 54, "k": 5, "b": "34:1", "e": "34:12" },
674
+ "8": { "p": 1, "k": 1, "b": "1:1", "e": "2:3" },
675
+ "M": { "p": 41, "k": 4, "b": "29:35", "e": "30:1" } }
676
+ },
641
677
  "Shabbat Rosh Chodesh Chanukah": {
642
678
  "haft": { "k": "Zechariah", "b": "2:14", "e": "4:7" },
643
679
  "fullkriyah": { "7": { "p": 41, "k": 4, "b": "28:9", "e": "28:15" },
@@ -927,8 +963,8 @@ function getLeyningKeyForEvent(ev, il = false) {
927
963
  const day = hd.getDate();
928
964
  const dow = hd.abs() % 7;
929
965
  const month = hd.getMonth();
930
- const isShabbat = dow == 6;
931
- const isRoshChodesh = day == 1 || day == 30;
966
+ const isShabbat = dow === 6;
967
+ const isRoshChodesh = day === 1 || day === 30;
932
968
  const holiday = ev.basename();
933
969
  const isPesach = holiday === 'Pesach';
934
970
  if (il && isPesach) {
@@ -939,7 +975,7 @@ function getLeyningKeyForEvent(ev, il = false) {
939
975
  }
940
976
  return desc;
941
977
  }
942
- if (day == 1 && month === core.months.TISHREI) {
978
+ if (day === 1 && month === core.months.TISHREI) {
943
979
  return isShabbat ? 'Rosh Hashana I (on Shabbat)' : 'Rosh Hashana I';
944
980
  }
945
981
  const cholHaMoedDay = ev.cholHaMoedDay;
@@ -948,7 +984,7 @@ function getLeyningKeyForEvent(ev, il = false) {
948
984
  if (isShabbat) {
949
985
  return holiday + ' Shabbat Chol ha-Moed';
950
986
  }
951
- else if (desc == 'Sukkot VII (Hoshana Raba)') {
987
+ else if (desc === 'Sukkot VII (Hoshana Raba)') {
952
988
  return 'Sukkot Final Day (Hoshana Raba)';
953
989
  }
954
990
  if (isPesach && cholHaMoedDay) {
@@ -966,7 +1002,7 @@ function getLeyningKeyForEvent(ev, il = false) {
966
1002
  if (isShabbat && isRoshChodesh) {
967
1003
  return 'Shabbat Rosh Chodesh Chanukah';
968
1004
  }
969
- else if (isRoshChodesh && chanukahDay == 7) {
1005
+ else if (isRoshChodesh && chanukahDay === 7) {
970
1006
  return 'Chanukah Day 7 (on Rosh Chodesh)';
971
1007
  }
972
1008
  else if (isShabbat) {
@@ -977,16 +1013,16 @@ function getLeyningKeyForEvent(ev, il = false) {
977
1013
  }
978
1014
  }
979
1015
  if (isRoshChodesh &&
980
- (desc == 'Shabbat HaChodesh' || desc == 'Shabbat Shekalim')) {
1016
+ (desc === 'Shabbat HaChodesh' || desc === 'Shabbat Shekalim')) {
981
1017
  return desc + ' (on Rosh Chodesh)';
982
1018
  }
983
- if (il && desc == 'Shmini Atzeret') {
984
- return 'Simchat Torah';
1019
+ if (il && desc === 'Shmini Atzeret') {
1020
+ return 'Simchat Torah' + (isShabbat ? ' (on Shabbat)' : '');
985
1021
  }
986
1022
  if (desc === 'Chag HaBanot') {
987
1023
  return undefined;
988
1024
  }
989
- if (isShabbat && 'Shabbat' != desc.substring(0, 7)) {
1025
+ if (isShabbat && 'Shabbat' !== desc.substring(0, 7)) {
990
1026
  if (isRoshChodesh) {
991
1027
  if (desc === 'Rosh Chodesh Tevet') {
992
1028
  return 'Shabbat Rosh Chodesh Chanukah';
@@ -1215,13 +1251,15 @@ function getLeyningForHolidayKey(key, cholHaMoedDay, il) {
1215
1251
  leyning.sephardic = makeSummaryFromParts(seph);
1216
1252
  leyning.sephardicNumV = sumVerses(seph);
1217
1253
  }
1218
- if (src.megillah) {
1219
- const book = src.megillah;
1220
- const chaps = numverses[book];
1254
+ let megillah = src.megillah;
1255
+ if (il && key === 'Pesach I (on Shabbat)')
1256
+ megillah = 'Song of Songs';
1257
+ if (megillah) {
1258
+ const chaps = NUM_VERSES[megillah];
1221
1259
  const m = {};
1222
1260
  for (let i = 1; i < chaps.length; i++) {
1223
1261
  const numv = chaps[i];
1224
- m[`${i}`] = { k: book, b: `${i}:1`, e: `${i}:${numv}`, v: numv };
1262
+ m[`${i}`] = { k: megillah, b: `${i}:1`, e: `${i}:${numv}`, v: numv };
1225
1263
  }
1226
1264
  leyning.megillah = m;
1227
1265
  }
@@ -2549,10 +2587,10 @@ const parshiyotObj = parshiyotObj0;
2549
2587
  */
2550
2588
  function getHaftaraKey(parsha) {
2551
2589
  const first = parsha[0];
2552
- if (parsha.length === 2 && first == 'Achrei Mot') {
2590
+ if (parsha.length === 2 && first === 'Achrei Mot') {
2553
2591
  return parshaToString(parsha); // 'Achrei Mot-Kedoshim'
2554
2592
  }
2555
- if (parsha.length === 1 || first == 'Nitzavim') {
2593
+ if (parsha.length === 1 || first === 'Nitzavim') {
2556
2594
  return first;
2557
2595
  }
2558
2596
  else {
@@ -2658,7 +2696,7 @@ function getLeyningForParshaHaShavua(ev, il = false) {
2658
2696
  if (typeof ev !== 'object' || typeof ev.getFlags !== 'function') {
2659
2697
  throw new TypeError(`Bad event argument: ${ev}`);
2660
2698
  }
2661
- else if (ev.getFlags() != core.flags.PARSHA_HASHAVUA) {
2699
+ else if (ev.getFlags() !== core.flags.PARSHA_HASHAVUA) {
2662
2700
  throw new TypeError(`Event must be parsha hashavua: ${ev.getDesc()}`);
2663
2701
  }
2664
2702
  // first, collect the default aliyot and haftara
@@ -2752,6 +2790,7 @@ function findParshaHaShavua(saturday, il) {
2752
2790
  parsha: ['Vezot Haberakhah'],
2753
2791
  chag: false,
2754
2792
  num: 54,
2793
+ hdate: saturday,
2755
2794
  };
2756
2795
  }
2757
2796
  }
@@ -2768,23 +2807,6 @@ function findParshaHaShavua(saturday, il) {
2768
2807
  /* NOTREACHED */
2769
2808
  throw new Error(`can't findParshaHaShavua for ${saturday}/${il}`);
2770
2809
  }
2771
- /**
2772
- * Looks up leyning for a regular Shabbat, Monday/Thursday weekday or holiday.
2773
- *
2774
- * If `hdate` coincides with a holiday that has Torah reading, returns the
2775
- * reading for that day (see {@link getLeyningForHoliday})
2776
- *
2777
- * Otherwise, if `hdate` is a Saturday, returns {@link getLeyningForParshaHaShavua}
2778
- *
2779
- * Otherwise, if `hdate` is a Monday or Thursday, returns {@link Leyning} for the
2780
- * Parashat haShavua, containing only the `weekday` aliyot (no `fullkriyah`).
2781
- *
2782
- * Otherwise, returns `undefined`.
2783
- *
2784
- * @param {HDate} hdate Hebrew Date
2785
- * @param {boolean} il in Israel
2786
- * @param {boolean} [wantarray] to return an array of 0 or more readings
2787
- */
2788
2810
  function getLeyningOnDate(hdate, il, wantarray = false) {
2789
2811
  const dow = hdate.getDay();
2790
2812
  const arr = [];
@@ -2973,7 +2995,7 @@ function getFullKriyahLines(reading) {
2973
2995
  if (reading.fullkriyah) {
2974
2996
  for (const [num, a] of Object.entries(reading.fullkriyah)) {
2975
2997
  if (typeof a !== 'undefined') {
2976
- const k = num == 'M' ? 'maf' : num;
2998
+ const k = num === 'M' ? 'maf' : num;
2977
2999
  let aliyah = formatAliyahWithBook(a);
2978
3000
  if ((_a = reading.reason) === null || _a === void 0 ? void 0 : _a[num]) {
2979
3001
  aliyah += ' | ' + reading.reason[num];
@@ -3017,6 +3039,7 @@ function getFullKriyahLines(reading) {
3017
3039
  }
3018
3040
 
3019
3041
  exports.BOOK = BOOK;
3042
+ exports.NUM_VERSES = NUM_VERSES;
3020
3043
  exports.calculateNumVerses = calculateNumVerses;
3021
3044
  exports.clone = clone;
3022
3045
  exports.cloneHaftara = cloneHaftara;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './types';
2
+ import './locale';
2
3
  export * from './common';
3
4
  export * from './summary';
4
5
  export * from './festival';
package/dist/index.mjs CHANGED
@@ -1,5 +1,20 @@
1
- /*! @hebcal/leyning v8.2.7 */
2
- import { flags, months, HDate, HebrewCalendar, Locale, ParshaEvent, HolidayEvent, Event } from '@hebcal/core';
1
+ /*! @hebcal/leyning v8.2.9 */
2
+ import { Locale, flags, months, HDate, HebrewCalendar, ParshaEvent, HolidayEvent, Event } from '@hebcal/core';
3
+
4
+ var poHe = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);" }, "contexts": { "": { "Shabbat Machar Chodesh": ["שַׁבָּת מָחָר חוֹדֶשׁ"], "Shabbat Rosh Chodesh": ["שַׁבָּת רֹאשׁ חוֹדֶשׁ"], "Pesach I (on Shabbat)": ["פֶּסַח יוֹם א׳ (בְּשַׁבָּת)"], "Pesach Chol ha-Moed Day 1": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם א׳"], "Pesach Chol ha-Moed Day 2": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ב׳"], "Pesach Chol ha-Moed Day 2 on Sunday": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ב׳ (בְּיוֹם רִאשׁוֹן)"], "Pesach Chol ha-Moed Day 3": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ג׳"], "Pesach Chol ha-Moed Day 3 on Monday": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ג׳ (בְּיוֹם שָׁנִי)"], "Pesach Chol ha-Moed Day 4": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ד׳"], "Pesach Chol ha-Moed Day 5": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ה׳"], "Pesach Shabbat Chol ha-Moed": ["פֶּסַח שַׁבָּת חוֹל הַמּוֹעֵד"], "Pesach VII (on Shabbat)": ["פֶּסַח ז׳ (בְּשַׁבָּת)"], "Pesach VIII (on Shabbat)": ["פֶּסַח ח׳ (בְּשַׁבָּת)"], "Shavuot II (on Shabbat)": ["שָׁבוּעוֹת יוֹם ב׳ (בְּשַׁבָּת)"], "Rosh Hashana I (on Shabbat)": ["רֹאשׁ הַשָּׁנָה יוֹם א׳ (בְּשַׁבָּת)"], "Yom Kippur (on Shabbat)": ["יוֹם כִּפּוּר (בְּשַׁבָּת)"], "Yom Kippur (Mincha, Traditional)": ["יוֹם כִּפּוּר מִנחָה"], "Yom Kippur (Mincha, Alternate)": ["יוֹם כִּפּוּר מִנחָה"], "Sukkot I (on Shabbat)": ["סוּכּוֹת יוֹם א׳ (בְּשַׁבָּת)"], "Sukkot Chol ha-Moed Day 1": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם א׳"], "Sukkot Chol ha-Moed Day 2": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ב׳"], "Sukkot Chol ha-Moed Day 3": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ג׳"], "Sukkot Chol ha-Moed Day 4": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ד׳"], "Sukkot Chol ha-Moed Day 5": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ה׳"], "Sukkot Shabbat Chol ha-Moed": ["סוּכּוֹת שַׁבָּת חוֹל הַמּוֹעֵד"], "Sukkot Final Day (Hoshana Raba)": ["סוּכּוֹת ז׳ (הוֹשַׁעְנָא רַבָּה)"], "Shmini Atzeret (on Shabbat)": ["שְׁמִינִי עֲצֶרֶת (בְּשַׁבָּת)"], "Chanukah Day 1": ["חֲנוּכָּה יוֹם א׳"], "Chanukah Day 2": ["חֲנוּכָּה יוֹם ב׳"], "Chanukah Day 3": ["חֲנוּכָּה יוֹם ג׳"], "Chanukah Day 4": ["חֲנוּכָּה יוֹם ד׳"], "Chanukah Day 5": ["חֲנוּכָּה יוֹם ה׳"], "Chanukah Day 6": ["חֲנוּכָּה יוֹם ו׳"], "Chanukah Day 7": ["חֲנוּכָּה יוֹם ז׳"], "Chanukah Day 7 (on Rosh Chodesh)": ["חֲנוּכָּה יוֹם ז׳ (רֹאשׁ חוֹדֶשׁ)"], "Chanukah Day 8": ["חֲנוּכָּה יוֹם ח׳"], "Chanukah Day 1 (on Shabbat)": ["חֲנוּכָּה יוֹם א׳ (בְּשַׁבָּת)"], "Chanukah Day 2 (on Shabbat)": ["חֲנוּכָּה יוֹם ב׳ (בְּשַׁבָּת)"], "Chanukah Day 3 (on Shabbat)": ["חֲנוּכָּה יוֹם ג׳ (בְּשַׁבָּת)"], "Chanukah Day 4 (on Shabbat)": ["חֲנוּכָּה יוֹם ד׳ (בְּשַׁבָּת)"], "Chanukah Day 5 (on Shabbat)": ["חֲנוּכָּה יוֹם ה׳ (בְּשַׁבָּת)"], "Chanukah Day 7 (on Shabbat)": ["חֲנוּכָּה יוֹם ז׳ (בְּשַׁבָּת)"], "Chanukah Day 8 (on Shabbat)": ["חֲנוּכָּה יוֹם ח׳ (בְּשַׁבָּת)"], "Shabbat Rosh Chodesh Chanukah": ["שַׁבָּת רֹאשׁ חוֹדֶשׁ חֲנוּכָּה"], "Yom Kippur (Mincha)": ["יוֹם כִּפּוּר מִנחָה"], "Tish'a B'Av (Mincha)": ["תִּשְׁעָה בְּאָב מִנחָה"], "Asara B'Tevet (Mincha)": ["עֲשָׂרָה בְּטֵבֵת מִנחָה"], "Ta'anit Bechorot (Mincha)": ["תַּעֲנִית בְּכוֹרוֹת מִנחָה"], "Ta'anit Esther (Mincha)": ["תַּעֲנִית אֶסְתֵּר מִנחָה"], "Tzom Gedaliah (Mincha)": ["צוֹם גְּדַלְיָה מִנחָה"], "Tzom Tammuz (Mincha)": ["צוֹם תָּמוּז מִנחָה"] } } };
5
+
6
+ Locale.addTranslations('he', poHe);
7
+ Locale.addTranslations('h', poHe);
8
+ const heStrs = poHe.contexts[''];
9
+ const heNoNikud = {};
10
+ for (const [key, val] of Object.entries(heStrs)) {
11
+ heNoNikud[key] = [Locale.hebrewStripNikkud(val[0])];
12
+ }
13
+ const poHeNoNikud = {
14
+ headers: poHe.headers,
15
+ contexts: { '': heNoNikud },
16
+ };
17
+ Locale.addTranslations('he-x-NoNikud', poHeNoNikud);
3
18
 
4
19
  var numverses = {
5
20
  "Genesis": [0,
@@ -61,6 +76,11 @@ const BOOK = [
61
76
  'Numbers',
62
77
  'Deuteronomy',
63
78
  ];
79
+ /**
80
+ * The number of verses in each book of the Tanakh.
81
+ * @readonly
82
+ */
83
+ const NUM_VERSES = numverses;
64
84
  /**
65
85
  * Formats parsha as a string
66
86
  * @param parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
@@ -75,7 +95,7 @@ function parshaToString(parsha) {
75
95
  throw new TypeError(`Bad parsha argument: ${parsha}`);
76
96
  }
77
97
  let s = parsha[0];
78
- if (parsha.length == 2) {
98
+ if (parsha.length === 2) {
79
99
  s += '-' + parsha[1];
80
100
  }
81
101
  return s;
@@ -99,7 +119,7 @@ function calculateNumVerses(aliyah) {
99
119
  aliyah.v = v2 - v1 + 1;
100
120
  }
101
121
  else if (typeof aliyah.k === 'string') {
102
- const numv = numverses[aliyah.k];
122
+ const numv = NUM_VERSES[aliyah.k];
103
123
  if (typeof numv !== 'object' || !numv.length) {
104
124
  throw new ReferenceError(`Can't find numverses for ${aliyah.k}`);
105
125
  }
@@ -341,6 +361,7 @@ var festivals0 = { "Pesach I": {
341
361
  "M": { "p": 41, "k": 4, "b": "28:19", "e": "28:25" } }
342
362
  },
343
363
  "Pesach VII (on Shabbat)": {
364
+ "megillah": "Song of Songs",
344
365
  "haft": { "k": "II Samuel", "b": "22:1", "e": "22:51" },
345
366
  "fullkriyah": { "1": { "p": 16, "k": 2, "b": "13:17", "e": "13:19" },
346
367
  "2": { "p": 16, "k": 2, "b": "13:20", "e": "13:22" },
@@ -361,6 +382,7 @@ var festivals0 = { "Pesach I": {
361
382
  "M": { "p": 41, "k": 4, "b": "28:19", "e": "28:25" } }
362
383
  },
363
384
  "Pesach VIII (on Shabbat)": {
385
+ "megillah": "Song of Songs",
364
386
  "haft": { "k": "Isaiah", "b": "10:32", "e": "12:6" },
365
387
  "fullkriyah": { "1": { "p": 47, "k": 5, "b": "14:22", "e": "14:29" },
366
388
  "2": { "p": 47, "k": 5, "b": "15:1", "e": "15:18" },
@@ -610,6 +632,7 @@ var festivals0 = { "Pesach I": {
610
632
  "M": { "p": 41, "k": 4, "b": "29:35", "e": "30:1" } }
611
633
  },
612
634
  "Shmini Atzeret (on Shabbat)": {
635
+ "megillah": "Ecclesiastes",
613
636
  "haft": { "k": "I Kings", "b": "8:54", "e": "8:66" },
614
637
  "fullkriyah": { "1": { "p": 47, "k": 5, "b": "14:22", "e": "14:29" },
615
638
  "2": { "p": 47, "k": 5, "b": "15:1", "e": "15:18" },
@@ -636,6 +659,19 @@ var festivals0 = { "Pesach I": {
636
659
  "7": { "p": 1, "k": 1, "b": "1:1", "e": "2:3" },
637
660
  "M": { "p": 41, "k": 4, "b": "29:35", "e": "30:1" } }
638
661
  },
662
+ "Simchat Torah (on Shabbat)": {
663
+ "megillah": "Ecclesiastes",
664
+ "haft": { "k": "Joshua", "b": "1:1", "e": "1:18" },
665
+ "fullkriyah": { "1": { "p": 54, "k": 5, "b": "33:1", "e": "33:7" },
666
+ "2": { "p": 54, "k": 5, "b": "33:8", "e": "33:12" },
667
+ "3": { "p": 54, "k": 5, "b": "33:13", "e": "33:17" },
668
+ "4": { "p": 54, "k": 5, "b": "33:18", "e": "33:21" },
669
+ "5": { "p": 54, "k": 5, "b": "33:22", "e": "33:26" },
670
+ "6": { "p": 54, "k": 5, "b": "33:27", "e": "33:29" },
671
+ "7": { "p": 54, "k": 5, "b": "34:1", "e": "34:12" },
672
+ "8": { "p": 1, "k": 1, "b": "1:1", "e": "2:3" },
673
+ "M": { "p": 41, "k": 4, "b": "29:35", "e": "30:1" } }
674
+ },
639
675
  "Shabbat Rosh Chodesh Chanukah": {
640
676
  "haft": { "k": "Zechariah", "b": "2:14", "e": "4:7" },
641
677
  "fullkriyah": { "7": { "p": 41, "k": 4, "b": "28:9", "e": "28:15" },
@@ -925,8 +961,8 @@ function getLeyningKeyForEvent(ev, il = false) {
925
961
  const day = hd.getDate();
926
962
  const dow = hd.abs() % 7;
927
963
  const month = hd.getMonth();
928
- const isShabbat = dow == 6;
929
- const isRoshChodesh = day == 1 || day == 30;
964
+ const isShabbat = dow === 6;
965
+ const isRoshChodesh = day === 1 || day === 30;
930
966
  const holiday = ev.basename();
931
967
  const isPesach = holiday === 'Pesach';
932
968
  if (il && isPesach) {
@@ -937,7 +973,7 @@ function getLeyningKeyForEvent(ev, il = false) {
937
973
  }
938
974
  return desc;
939
975
  }
940
- if (day == 1 && month === months.TISHREI) {
976
+ if (day === 1 && month === months.TISHREI) {
941
977
  return isShabbat ? 'Rosh Hashana I (on Shabbat)' : 'Rosh Hashana I';
942
978
  }
943
979
  const cholHaMoedDay = ev.cholHaMoedDay;
@@ -946,7 +982,7 @@ function getLeyningKeyForEvent(ev, il = false) {
946
982
  if (isShabbat) {
947
983
  return holiday + ' Shabbat Chol ha-Moed';
948
984
  }
949
- else if (desc == 'Sukkot VII (Hoshana Raba)') {
985
+ else if (desc === 'Sukkot VII (Hoshana Raba)') {
950
986
  return 'Sukkot Final Day (Hoshana Raba)';
951
987
  }
952
988
  if (isPesach && cholHaMoedDay) {
@@ -964,7 +1000,7 @@ function getLeyningKeyForEvent(ev, il = false) {
964
1000
  if (isShabbat && isRoshChodesh) {
965
1001
  return 'Shabbat Rosh Chodesh Chanukah';
966
1002
  }
967
- else if (isRoshChodesh && chanukahDay == 7) {
1003
+ else if (isRoshChodesh && chanukahDay === 7) {
968
1004
  return 'Chanukah Day 7 (on Rosh Chodesh)';
969
1005
  }
970
1006
  else if (isShabbat) {
@@ -975,16 +1011,16 @@ function getLeyningKeyForEvent(ev, il = false) {
975
1011
  }
976
1012
  }
977
1013
  if (isRoshChodesh &&
978
- (desc == 'Shabbat HaChodesh' || desc == 'Shabbat Shekalim')) {
1014
+ (desc === 'Shabbat HaChodesh' || desc === 'Shabbat Shekalim')) {
979
1015
  return desc + ' (on Rosh Chodesh)';
980
1016
  }
981
- if (il && desc == 'Shmini Atzeret') {
982
- return 'Simchat Torah';
1017
+ if (il && desc === 'Shmini Atzeret') {
1018
+ return 'Simchat Torah' + (isShabbat ? ' (on Shabbat)' : '');
983
1019
  }
984
1020
  if (desc === 'Chag HaBanot') {
985
1021
  return undefined;
986
1022
  }
987
- if (isShabbat && 'Shabbat' != desc.substring(0, 7)) {
1023
+ if (isShabbat && 'Shabbat' !== desc.substring(0, 7)) {
988
1024
  if (isRoshChodesh) {
989
1025
  if (desc === 'Rosh Chodesh Tevet') {
990
1026
  return 'Shabbat Rosh Chodesh Chanukah';
@@ -1213,13 +1249,15 @@ function getLeyningForHolidayKey(key, cholHaMoedDay, il) {
1213
1249
  leyning.sephardic = makeSummaryFromParts(seph);
1214
1250
  leyning.sephardicNumV = sumVerses(seph);
1215
1251
  }
1216
- if (src.megillah) {
1217
- const book = src.megillah;
1218
- const chaps = numverses[book];
1252
+ let megillah = src.megillah;
1253
+ if (il && key === 'Pesach I (on Shabbat)')
1254
+ megillah = 'Song of Songs';
1255
+ if (megillah) {
1256
+ const chaps = NUM_VERSES[megillah];
1219
1257
  const m = {};
1220
1258
  for (let i = 1; i < chaps.length; i++) {
1221
1259
  const numv = chaps[i];
1222
- m[`${i}`] = { k: book, b: `${i}:1`, e: `${i}:${numv}`, v: numv };
1260
+ m[`${i}`] = { k: megillah, b: `${i}:1`, e: `${i}:${numv}`, v: numv };
1223
1261
  }
1224
1262
  leyning.megillah = m;
1225
1263
  }
@@ -2547,10 +2585,10 @@ const parshiyotObj = parshiyotObj0;
2547
2585
  */
2548
2586
  function getHaftaraKey(parsha) {
2549
2587
  const first = parsha[0];
2550
- if (parsha.length === 2 && first == 'Achrei Mot') {
2588
+ if (parsha.length === 2 && first === 'Achrei Mot') {
2551
2589
  return parshaToString(parsha); // 'Achrei Mot-Kedoshim'
2552
2590
  }
2553
- if (parsha.length === 1 || first == 'Nitzavim') {
2591
+ if (parsha.length === 1 || first === 'Nitzavim') {
2554
2592
  return first;
2555
2593
  }
2556
2594
  else {
@@ -2656,7 +2694,7 @@ function getLeyningForParshaHaShavua(ev, il = false) {
2656
2694
  if (typeof ev !== 'object' || typeof ev.getFlags !== 'function') {
2657
2695
  throw new TypeError(`Bad event argument: ${ev}`);
2658
2696
  }
2659
- else if (ev.getFlags() != flags.PARSHA_HASHAVUA) {
2697
+ else if (ev.getFlags() !== flags.PARSHA_HASHAVUA) {
2660
2698
  throw new TypeError(`Event must be parsha hashavua: ${ev.getDesc()}`);
2661
2699
  }
2662
2700
  // first, collect the default aliyot and haftara
@@ -2750,6 +2788,7 @@ function findParshaHaShavua(saturday, il) {
2750
2788
  parsha: ['Vezot Haberakhah'],
2751
2789
  chag: false,
2752
2790
  num: 54,
2791
+ hdate: saturday,
2753
2792
  };
2754
2793
  }
2755
2794
  }
@@ -2766,23 +2805,6 @@ function findParshaHaShavua(saturday, il) {
2766
2805
  /* NOTREACHED */
2767
2806
  throw new Error(`can't findParshaHaShavua for ${saturday}/${il}`);
2768
2807
  }
2769
- /**
2770
- * Looks up leyning for a regular Shabbat, Monday/Thursday weekday or holiday.
2771
- *
2772
- * If `hdate` coincides with a holiday that has Torah reading, returns the
2773
- * reading for that day (see {@link getLeyningForHoliday})
2774
- *
2775
- * Otherwise, if `hdate` is a Saturday, returns {@link getLeyningForParshaHaShavua}
2776
- *
2777
- * Otherwise, if `hdate` is a Monday or Thursday, returns {@link Leyning} for the
2778
- * Parashat haShavua, containing only the `weekday` aliyot (no `fullkriyah`).
2779
- *
2780
- * Otherwise, returns `undefined`.
2781
- *
2782
- * @param {HDate} hdate Hebrew Date
2783
- * @param {boolean} il in Israel
2784
- * @param {boolean} [wantarray] to return an array of 0 or more readings
2785
- */
2786
2808
  function getLeyningOnDate(hdate, il, wantarray = false) {
2787
2809
  const dow = hdate.getDay();
2788
2810
  const arr = [];
@@ -2971,7 +2993,7 @@ function getFullKriyahLines(reading) {
2971
2993
  if (reading.fullkriyah) {
2972
2994
  for (const [num, a] of Object.entries(reading.fullkriyah)) {
2973
2995
  if (typeof a !== 'undefined') {
2974
- const k = num == 'M' ? 'maf' : num;
2996
+ const k = num === 'M' ? 'maf' : num;
2975
2997
  let aliyah = formatAliyahWithBook(a);
2976
2998
  if ((_a = reading.reason) === null || _a === void 0 ? void 0 : _a[num]) {
2977
2999
  aliyah += ' | ' + reading.reason[num];
@@ -3014,4 +3036,4 @@ function getFullKriyahLines(reading) {
3014
3036
  return lines;
3015
3037
  }
3016
3038
 
3017
- 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 };
3039
+ 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 };
@@ -0,0 +1 @@
1
+ export {};
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: string[];
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?: boolean): (Leyning | LeyningWeekday) | (Leyning | LeyningWeekday)[] | undefined;
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.7",
3
+ "version": "8.2.9",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "keywords": [
6
6
  "hebcal",
@@ -40,13 +40,14 @@
40
40
  "leyning-csv": "bin/leyning-csv"
41
41
  },
42
42
  "dependencies": {
43
- "@hebcal/core": "^5.5.2",
44
- "tslib": "^2.7.0"
43
+ "@hebcal/core": "^5.6.1",
44
+ "tslib": "^2.8.1"
45
45
  },
46
46
  "scripts": {
47
+ "po2json": "node ./po2json.cjs po/*.po",
47
48
  "build:rollup": "rollup -c",
48
49
  "build:json2js": "for f in src/*.json; do echo 'export default' > $f.ts && cat $f >> $f.ts; done",
49
- "build": "npm run build:json2js && npm run build:rollup",
50
+ "build": "npm run po2json && npm run build:json2js && npm run build:rollup",
50
51
  "prepublish": "npm run build",
51
52
  "docs": "typedoc",
52
53
  "pretest": "npm run build",
@@ -57,22 +58,28 @@
57
58
  "fix": "gts fix"
58
59
  },
59
60
  "license": "BSD-2-Clause",
61
+ "overrides": {
62
+ "babel-plugin-ttag@1.8.16": {
63
+ "babel-plugin-macros": "3.1.0"
64
+ }
65
+ },
60
66
  "devDependencies": {
61
- "@babel/preset-env": "^7.25.8",
62
- "@babel/preset-typescript": "^7.25.7",
63
- "@rollup/plugin-commonjs": "^28.0.0",
67
+ "@babel/preset-env": "^7.26.0",
68
+ "@babel/preset-typescript": "^7.26.0",
69
+ "@rollup/plugin-commonjs": "^28.0.1",
64
70
  "@rollup/plugin-json": "^6.1.0",
65
71
  "@rollup/plugin-node-resolve": "^15.3.0",
66
72
  "@rollup/plugin-terser": "^0.4.4",
67
- "@rollup/plugin-typescript": "^12.1.0",
68
- "@types/jest": "^29.5.13",
69
- "@types/node": "^22.7.5",
70
- "gts": "^6.0.0",
73
+ "@rollup/plugin-typescript": "^12.1.1",
74
+ "@types/jest": "^29.5.14",
75
+ "@types/node": "^22.8.7",
76
+ "gts": "^5.3.1",
71
77
  "jest": "^29.7.0",
72
- "rollup": "^4.24.0",
78
+ "rollup": "^4.24.3",
73
79
  "rollup-plugin-dts": "^6.1.1",
74
80
  "ts-jest": "^29.2.5",
75
- "typedoc": "^0.26.9",
81
+ "ttag-cli": "^1.10.12",
82
+ "typedoc": "^0.26.11",
76
83
  "typescript": "^5.6.3"
77
84
  }
78
85
  }