@hebcal/core 6.6.0 → 6.7.0

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.
Files changed (147) hide show
  1. package/README.md +4 -4
  2. package/dist/bundle.js +183 -50
  3. package/dist/bundle.js.map +1 -1
  4. package/dist/bundle.min.js +18 -18
  5. package/dist/bundle.min.js.map +1 -1
  6. package/dist/esm/CalOptions.d.ts +15 -3
  7. package/dist/esm/DailyLearning.js +1 -1
  8. package/dist/esm/HebrewDateEvent.js +1 -1
  9. package/dist/esm/HolidayEvent.js +1 -1
  10. package/dist/esm/MevarchimChodeshEvent.js +1 -1
  11. package/dist/esm/ParshaEvent.js +16 -6
  12. package/dist/esm/ParshaEvent.js.map +1 -1
  13. package/dist/esm/TimedEvent.js +1 -1
  14. package/dist/esm/TimedEvent.js.map +1 -1
  15. package/dist/esm/YomKippurKatanEvent.js +1 -1
  16. package/dist/esm/ashkenazi.po.js +2 -2
  17. package/dist/esm/ashkenazi.po.js.map +1 -1
  18. package/dist/esm/calendar.js +14 -20
  19. package/dist/esm/calendar.js.map +1 -1
  20. package/dist/esm/candles.d.ts +8 -3
  21. package/dist/esm/candles.js +65 -11
  22. package/dist/esm/candles.js.map +1 -1
  23. package/dist/esm/cities.json.js +1 -1
  24. package/dist/esm/event.js +1 -1
  25. package/dist/esm/getStartAndEnd.js +1 -1
  26. package/dist/esm/hallel.js +1 -1
  27. package/dist/esm/he-x-NoNikud.po.js +1 -1
  28. package/dist/esm/he.po.js +1 -1
  29. package/dist/esm/hebcal.js +1 -1
  30. package/dist/esm/holidays.js +1 -1
  31. package/dist/esm/holidays.js.map +1 -1
  32. package/dist/esm/index.js +1 -1
  33. package/dist/esm/isAssurBemlacha.js +1 -1
  34. package/dist/esm/isAveilut.js +1 -1
  35. package/dist/esm/isFastDay.js +1 -1
  36. package/dist/esm/locale.js +1 -1
  37. package/dist/esm/location.js +1 -1
  38. package/dist/esm/location.js.map +1 -1
  39. package/dist/esm/modern.js +1 -1
  40. package/dist/esm/molad.js +1 -1
  41. package/dist/esm/moladBase.js +1 -1
  42. package/dist/esm/moladDate.js +1 -1
  43. package/dist/esm/moladDate.js.map +1 -1
  44. package/dist/esm/omer.js +1 -1
  45. package/dist/esm/parshaName.js +1 -1
  46. package/dist/esm/parshaYear.js +1 -1
  47. package/dist/esm/pkgVersion.d.ts +1 -1
  48. package/dist/esm/pkgVersion.js +2 -2
  49. package/dist/esm/pkgVersion.js.map +1 -1
  50. package/dist/esm/reformatTimeStr.js +1 -1
  51. package/dist/esm/reformatTimeStr.js.map +1 -1
  52. package/dist/esm/sedra.d.ts +14 -0
  53. package/dist/esm/sedra.js +62 -1
  54. package/dist/esm/sedra.js.map +1 -1
  55. package/dist/esm/sefira.json.js +1 -1
  56. package/dist/esm/staticHolidays.js +1 -1
  57. package/dist/esm/string.js +1 -1
  58. package/dist/esm/tachanun.js +1 -1
  59. package/dist/esm/tachanun.js.map +1 -1
  60. package/dist/esm/zmanim.js +2 -3
  61. package/dist/esm/zmanim.js.map +1 -1
  62. package/package.json +14 -17
  63. package/po/ashkenazi.po +1 -12
  64. package/dist/eslint.config.d.mts +0 -83
  65. package/dist/eslint.config.mjs +0 -29
  66. package/dist/po2json.d.ts +0 -1
  67. package/dist/po2json.js +0 -40
  68. package/dist/src/CalOptions.d.ts +0 -171
  69. package/dist/src/CalOptions.js +0 -1
  70. package/dist/src/DailyLearning.d.ts +0 -69
  71. package/dist/src/DailyLearning.js +0 -92
  72. package/dist/src/HebrewDateEvent.d.ts +0 -37
  73. package/dist/src/HebrewDateEvent.js +0 -72
  74. package/dist/src/HolidayEvent.d.ts +0 -117
  75. package/dist/src/HolidayEvent.js +0 -236
  76. package/dist/src/MevarchimChodeshEvent.d.ts +0 -26
  77. package/dist/src/MevarchimChodeshEvent.js +0 -52
  78. package/dist/src/ParshaEvent.d.ts +0 -24
  79. package/dist/src/ParshaEvent.js +0 -50
  80. package/dist/src/TimedEvent.d.ts +0 -76
  81. package/dist/src/TimedEvent.js +0 -134
  82. package/dist/src/YomKippurKatanEvent.d.ts +0 -23
  83. package/dist/src/YomKippurKatanEvent.js +0 -40
  84. package/dist/src/ashkenazi.po.d.ts +0 -84
  85. package/dist/src/ashkenazi.po.js +0 -1
  86. package/dist/src/calendar.d.ts +0 -112
  87. package/dist/src/calendar.js +0 -721
  88. package/dist/src/candles.d.ts +0 -57
  89. package/dist/src/candles.js +0 -185
  90. package/dist/src/cities.json +0 -67
  91. package/dist/src/event.d.ts +0 -233
  92. package/dist/src/event.js +0 -295
  93. package/dist/src/getStartAndEnd.d.ts +0 -6
  94. package/dist/src/getStartAndEnd.js +0 -105
  95. package/dist/src/hallel.d.ts +0 -6
  96. package/dist/src/hallel.js +0 -39
  97. package/dist/src/he-x-NoNikud.po.d.ts +0 -28
  98. package/dist/src/he-x-NoNikud.po.js +0 -1
  99. package/dist/src/he.po.d.ts +0 -217
  100. package/dist/src/he.po.js +0 -1
  101. package/dist/src/hebcal.d.ts +0 -338
  102. package/dist/src/hebcal.js +0 -413
  103. package/dist/src/holidays.d.ts +0 -41
  104. package/dist/src/holidays.js +0 -324
  105. package/dist/src/index.d.ts +0 -30
  106. package/dist/src/index.js +0 -29
  107. package/dist/src/isAssurBemlacha.d.ts +0 -29
  108. package/dist/src/isAssurBemlacha.js +0 -82
  109. package/dist/src/isAveilut.d.ts +0 -22
  110. package/dist/src/isAveilut.js +0 -48
  111. package/dist/src/isFastDay.d.ts +0 -21
  112. package/dist/src/isFastDay.js +0 -31
  113. package/dist/src/locale.d.ts +0 -1
  114. package/dist/src/locale.js +0 -11
  115. package/dist/src/location.d.ts +0 -167
  116. package/dist/src/location.js +0 -342
  117. package/dist/src/modern.d.ts +0 -18
  118. package/dist/src/modern.js +0 -59
  119. package/dist/src/molad.d.ts +0 -164
  120. package/dist/src/molad.js +0 -298
  121. package/dist/src/moladBase.d.ts +0 -15
  122. package/dist/src/moladBase.js +0 -78
  123. package/dist/src/moladDate.d.ts +0 -12
  124. package/dist/src/moladDate.js +0 -58
  125. package/dist/src/omer.d.ts +0 -128
  126. package/dist/src/omer.js +0 -385
  127. package/dist/src/parshaName.d.ts +0 -2
  128. package/dist/src/parshaName.js +0 -13
  129. package/dist/src/parshaYear.d.ts +0 -20
  130. package/dist/src/parshaYear.js +0 -35
  131. package/dist/src/pkgVersion.d.ts +0 -2
  132. package/dist/src/pkgVersion.js +0 -2
  133. package/dist/src/reformatTimeStr.d.ts +0 -8
  134. package/dist/src/reformatTimeStr.js +0 -47
  135. package/dist/src/sedra.d.ts +0 -175
  136. package/dist/src/sedra.js +0 -563
  137. package/dist/src/sefira.json +0 -63
  138. package/dist/src/staticHolidays.d.ts +0 -192
  139. package/dist/src/staticHolidays.js +0 -637
  140. package/dist/src/string.d.ts +0 -2
  141. package/dist/src/string.js +0 -6
  142. package/dist/src/tachanun.d.ts +0 -29
  143. package/dist/src/tachanun.js +0 -120
  144. package/dist/src/zmanim.d.ts +0 -620
  145. package/dist/src/zmanim.js +0 -1003
  146. package/dist/version.d.ts +0 -1
  147. package/dist/version.js +0 -8
package/dist/src/sedra.js DELETED
@@ -1,563 +0,0 @@
1
- /*
2
- Hebcal - A Jewish Calendar Generator
3
- Copyright (c) 1994-2020 Danny Sadinoff
4
- Portions copyright Eyal Schachter and Michael J. Radwin
5
-
6
- https://github.com/hebcal/hebcal-es6
7
-
8
- This program is free software; you can redistribute it and/or
9
- modify it under the terms of the GNU General Public License
10
- as published by the Free Software Foundation; either version 2
11
- of the License, or (at your option) any later version.
12
-
13
- This program is distributed in the hope that it will be useful,
14
- but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- GNU General Public License for more details.
17
-
18
- You should have received a copy of the GNU General Public License
19
- along with this program. If not, see <http://www.gnu.org/licenses/>.
20
- */
21
- /*
22
- * Many of the following algorithms were taken from hebrew calendar
23
- * routines by Maimonedes, from his Mishneh Torah, and implemented by
24
- * Nachum Dershowitz Department of Computer Science
25
- * (217) 333-4219 University of Illinois at Urbana-Champaign
26
- * nachum@cs.uiuedu 1304 West Springfield Avenue
27
- * Urbana, Illinois 61801
28
- *
29
- * The routines were included in the emacs 19 distribution.
30
- *
31
- */
32
- import { HDate, months } from '@hebcal/hdate';
33
- import QuickLRU from 'quick-lru';
34
- import './locale'; // Adds Hebrew and Ashkenazic translations
35
- const INCOMPLETE = 0;
36
- const REGULAR = 1;
37
- const COMPLETE = 2;
38
- function yearType(hyear) {
39
- const longC = HDate.longCheshvan(hyear);
40
- const shortK = HDate.shortKislev(hyear);
41
- if (longC && !shortK) {
42
- return COMPLETE;
43
- }
44
- else if (!longC && shortK) {
45
- return INCOMPLETE;
46
- }
47
- else {
48
- return REGULAR;
49
- }
50
- }
51
- /**
52
- * Represents the weekly Torah-reading (Parashat HaShavua) schedule for an
53
- * entire Hebrew year.
54
- *
55
- * The schedule depends on the year's *keviyah* — the day of week of Rosh
56
- * Hashana, whether the year is leap, whether Cheshvan/Kislev are long or
57
- * short, and whether the schedule is for Israel or the Diaspora (since
58
- * Israel and the Diaspora diverge in some years when the 8th day of Pesach
59
- * or the 2nd day of Shavuot fall on Shabbat).
60
- *
61
- * Prefer {@link getSedra} (or {@link HebrewCalendar.getSedra}) over
62
- * calling this constructor directly, since both cache their results.
63
- *
64
- * @example
65
- * import {Sedra, HDate, months} from '@hebcal/core';
66
- * const sedra = new Sedra(5784, false);
67
- * const result = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));
68
- * console.log(result.parsha); // ['Lech-Lecha']
69
- */
70
- export class Sedra {
71
- year;
72
- il;
73
- rh;
74
- firstSaturday;
75
- theSedraArray;
76
- yearKey;
77
- /**
78
- * Calculates the Parashat HaShavua schedule for an entire Hebrew year.
79
- * @param hyear - Hebrew year (e.g. 5749)
80
- * @param il - Use Israel sedra schedule (false for Diaspora)
81
- */
82
- constructor(hyear, il) {
83
- hyear = +hyear;
84
- this.year = hyear;
85
- const rh0 = new HDate(1, months.TISHREI, hyear);
86
- const rh = (this.rh = rh0.abs());
87
- const rhDay = rh0.getDay() + 1;
88
- // find the first Saturday on or after Rosh Hashana
89
- this.firstSaturday = HDate.dayOnOrBefore(6, rh + 6);
90
- const leap = +HDate.isLeapYear(hyear);
91
- this.il = Boolean(il);
92
- const type = yearType(hyear);
93
- let key = `${leap}${rhDay}${type}`;
94
- if (types[key]) {
95
- this.theSedraArray = types[key];
96
- this.yearKey = key;
97
- }
98
- else {
99
- key = key + +this.il; // cast to num, then concat
100
- this.theSedraArray = types[key];
101
- this.yearKey = key;
102
- }
103
- if (!this.theSedraArray) {
104
- throw new Error(`improper sedra year type ${key} calculated for ${hyear}`);
105
- }
106
- }
107
- /**
108
- * Returns the date a parsha is read this year, or `null` if it does not
109
- * occur in this year's schedule.
110
- *
111
- * A doubled parsha (e.g. `'Matot-Masei'`) will only return a date in years
112
- * where that pair is actually read together; in years where they are read
113
- * separately, this returns `null`. Use {@link findContaining} to find the
114
- * date a parsha is read regardless of whether it is doubled.
115
- *
116
- * Throws `RangeError` for an out-of-range numeric input or an invalid
117
- * doubled-parsha pair, and `TypeError` for a malformed array argument.
118
- * @example
119
- * import {Sedra} from '@hebcal/core';
120
- * const sedra = new Sedra(5784, false);
121
- * sedra.find('Noach')?.toString(); // '15 Cheshvan 5784'
122
- * sedra.find(1)?.toString(); // same, by 0-based index
123
- * sedra.find('Matot-Masei')?.toString(); // null in 5784 — read separately
124
- * sedra.find(['Matot', 'Masei']); // also null in 5784
125
- * @param parsha if a `string`, specified with Sephardic transliterations
126
- * like `'Noach'` or `'Matot-Masei'`. If an array, must be a 1- or 2-element
127
- * array such as `['Noach']` or `['Matot', 'Masei']`. If a `number`, should
128
- * be a 0-based parsha index (`0` for Bereshit, `1` for Noach) or a negative
129
- * number for a doubled parsha (e.g. `-21` for Vayakhel-Pekudei)
130
- */
131
- find(parsha) {
132
- if (typeof parsha === 'number') {
133
- if (parsha >= parshiot.length || (parsha < 0 && !isValidDouble(parsha))) {
134
- throw new RangeError(`Invalid parsha number: ${parsha}`);
135
- }
136
- return this.findInternal(parsha);
137
- }
138
- else if (typeof parsha === 'string') {
139
- const num = parsha2id.get(parsha);
140
- if (typeof num === 'number') {
141
- return this.find(num);
142
- }
143
- else if (parsha.includes('-')) {
144
- if (parsha === CHMPESACH || parsha === CHMSUKOT) {
145
- return this.findInternal(parsha);
146
- }
147
- return this.find(parsha.split('-'));
148
- }
149
- else {
150
- // try to find Saturday holiday like 'Yom Kippur'
151
- return this.findInternal(parsha);
152
- }
153
- }
154
- else if (Array.isArray(parsha)) {
155
- const plen = parsha.length;
156
- if ((plen !== 1 && plen !== 2) || typeof parsha[0] !== 'string') {
157
- throw new TypeError(`Invalid parsha argument: ${JSON.stringify(parsha)}`);
158
- }
159
- if (plen === 1) {
160
- return this.find(parsha[0]);
161
- }
162
- const p1 = parsha[0];
163
- const p2 = parsha[1];
164
- const num1 = parsha2id.get(p1);
165
- const num2 = parsha2id.get(p2);
166
- if (typeof num1 !== 'number' ||
167
- typeof num2 !== 'number' ||
168
- num2 !== num1 + 1 ||
169
- !isValidDouble(-num1)) {
170
- throw new RangeError(`Unrecognized parsha name: ${p1}-${p2}`);
171
- }
172
- return this.find(-num1);
173
- }
174
- return null; /* NOTREACHED */
175
- }
176
- findInternal(parsha) {
177
- const idx = this.theSedraArray.indexOf(parsha);
178
- if (idx === -1) {
179
- return null; // doesn't occur this year
180
- }
181
- return new HDate(this.firstSaturday + idx * 7);
182
- }
183
- /**
184
- * Returns the date a parsha is read this year, looking through both
185
- * single and doubled forms.
186
- *
187
- * For example, if `'Matot'` is read individually this year, this returns
188
- * its date; if it is read as part of `'Matot-Masei'` this year, this
189
- * returns the date of `'Matot-Masei'` (and similarly for `'Masei'`).
190
- * Conversely, asking for `'Matot-Masei'` in a year where they are split
191
- * will return the date of `'Matot'` alone.
192
- * @example
193
- * import {Sedra} from '@hebcal/core';
194
- * const sedra = new Sedra(5784, false);
195
- * // Matot-Masei is split in 5784; both individual halves resolve:
196
- * sedra.findContaining('Matot')?.toString(); // '22 Tamuz 5784'
197
- * sedra.findContaining('Masei')?.toString(); // '29 Tamuz 5784'
198
- * // Asking for the doubled name returns the date of the first half:
199
- * sedra.findContaining('Matot-Masei')?.toString(); // '22 Tamuz 5784'
200
- */
201
- findContaining(parsha) {
202
- const hdate = this.find(parsha);
203
- if (hdate) {
204
- return hdate;
205
- }
206
- if (typeof parsha === 'number') {
207
- // a valid negative number (double parsha in a year where they are
208
- // combined) would've been found above, and a invalid negative number
209
- // would've thrown an error, so this parsha must be a positive number
210
- // representing either p1 or p2
211
- const p1 = -parsha;
212
- if (isValidDouble(p1)) {
213
- return this.find(p1);
214
- }
215
- else {
216
- // this must be the second individual parsha of a doubled pair
217
- // for example 29 for Kedoshim, so check for -28 for Achrei Mot-Kedoshim
218
- return this.find(p1 + 1);
219
- }
220
- }
221
- else {
222
- const num = parsha2id.get(parsha);
223
- if (num) {
224
- // parsha is either the first or second individual parsha of
225
- // a pair that is doubled this year
226
- const p1 = -num;
227
- if (isValidDouble(p1)) {
228
- return this.find(p1);
229
- }
230
- else {
231
- return this.find(p1 + 1);
232
- }
233
- }
234
- else {
235
- // this was indeed a doubled parsha, so return date of the first half
236
- const [p1] = parsha.split('-');
237
- return this.find(p1);
238
- }
239
- }
240
- }
241
- /**
242
- * Returns the underlying annual reading schedule as an array, where each
243
- * entry corresponds to one Saturday (starting from the first Shabbat on
244
- * or after Rosh Hashana). Entries are either:
245
- * - a non-negative `number`: a 0-based parsha index (e.g. `0` for
246
- * *Bereshit*)
247
- * - a negative `number`: the negated first index of a doubled parsha
248
- * (e.g. `-21` for *Vayakhel-Pekudei*)
249
- * - a `string`: a holiday name when a Yom Tov displaces the weekly reading
250
- * (e.g. `'Pesach Shabbat Chol ha-Moed'`, `'Yom Kippur'`)
251
- *
252
- * Used by `@hebcal/triennial`.
253
- */
254
- getSedraArray() {
255
- return this.theSedraArray;
256
- }
257
- /**
258
- * Returns the R.D. (Rata Die / Fixed Date) absolute day number of the
259
- * first Saturday on or after Rosh Hashana of this year. This is the
260
- * anchor point for {@link getSedraArray} — index `0` of that array
261
- * corresponds to this date.
262
- */
263
- getFirstSaturday() {
264
- return this.firstSaturday;
265
- }
266
- /** Returns the Hebrew year this `Sedra` instance covers. */
267
- getYear() {
268
- return this.year;
269
- }
270
- /**
271
- * Returns details about the parsha read on the first Saturday on or after
272
- * `hd`. If `hd` is itself a Saturday, the reading for that date is
273
- * returned; otherwise the reading for the upcoming Saturday is returned.
274
- *
275
- * If the given date falls in the final days of the Hebrew year (after
276
- * the last reading of this year's schedule), this method transparently
277
- * delegates to the next year's `Sedra`.
278
- * @example
279
- * import {Sedra, HDate, months} from '@hebcal/core';
280
- * const sedra = new Sedra(5784, false);
281
- * // A weekday — returns the upcoming Shabbat's reading
282
- * const result = sedra.lookup(new HDate(13, months.CHESHVAN, 5784));
283
- * console.log(result.parsha); // ['Lech-Lecha']
284
- * console.log(result.chag); // false
285
- * console.log(result.hdate.toString()); // '15 Cheshvan 5784' (Saturday)
286
- * @param hd Hebrew date or R.D. days
287
- */
288
- lookup(hd) {
289
- const abs = typeof hd === 'number' ? hd : HDate.isHDate(hd) ? hd.abs() : NaN;
290
- if (isNaN(abs)) {
291
- throw new TypeError(`Bad date argument: ${hd}`);
292
- }
293
- else if (abs < this.rh) {
294
- throw new RangeError(`Date ${hd} before start of Hebrew year ${this.year}`);
295
- }
296
- // find the first saturday on or after today's date
297
- const saturday = HDate.dayOnOrBefore(6, abs + 6);
298
- const weekNum = (saturday - this.firstSaturday) / 7;
299
- const index = this.theSedraArray[weekNum];
300
- if (index === undefined) {
301
- const sedra = getSedra(this.year + 1, this.il);
302
- return sedra.lookup(saturday); // must be next year
303
- }
304
- const hdate = new HDate(saturday);
305
- if (typeof index === 'string') {
306
- // Shabbat has a chag. Return a description
307
- return { parsha: [index], chag: true, hdate, il: this.il, num: 0 };
308
- }
309
- if (index >= 0) {
310
- return {
311
- parsha: [parshiot[index]],
312
- chag: false,
313
- num: index + 1,
314
- hdate,
315
- il: this.il,
316
- };
317
- }
318
- const p1 = D(index); // undouble the parsha
319
- return {
320
- parsha: [parshiot[p1], parshiot[p1 + 1]],
321
- chag: false,
322
- num: [p1 + 1, p1 + 2],
323
- hdate,
324
- il: this.il,
325
- };
326
- }
327
- }
328
- /**
329
- * The 54 parshiyot of the Torah as transilterated strings.
330
- * * parshiot[0] == `Bereshit`
331
- * * parshiot[1] == `Noach`
332
- * * parshiot[52] == `Ha'azinu`
333
- * * parshiot[53] == `Vezot Haberakhah`
334
- * @readonly
335
- * @type {string[]}
336
- */
337
- export const parshiot = [
338
- 'Bereshit',
339
- 'Noach',
340
- 'Lech-Lecha',
341
- 'Vayera',
342
- 'Chayei Sara',
343
- 'Toldot',
344
- 'Vayetzei',
345
- 'Vayishlach',
346
- 'Vayeshev',
347
- 'Miketz',
348
- 'Vayigash',
349
- 'Vayechi',
350
- 'Shemot',
351
- 'Vaera',
352
- 'Bo',
353
- 'Beshalach',
354
- 'Yitro',
355
- 'Mishpatim',
356
- 'Terumah',
357
- 'Tetzaveh',
358
- 'Ki Tisa',
359
- 'Vayakhel',
360
- 'Pekudei',
361
- 'Vayikra',
362
- 'Tzav',
363
- 'Shmini',
364
- 'Tazria',
365
- 'Metzora',
366
- 'Achrei Mot',
367
- 'Kedoshim',
368
- 'Emor',
369
- 'Behar',
370
- 'Bechukotai',
371
- 'Bamidbar',
372
- 'Nasso',
373
- "Beha'alotcha",
374
- "Sh'lach",
375
- 'Korach',
376
- 'Chukat',
377
- 'Balak',
378
- 'Pinchas',
379
- 'Matot',
380
- 'Masei',
381
- 'Devarim',
382
- 'Vaetchanan',
383
- 'Eikev',
384
- "Re'eh",
385
- 'Shoftim',
386
- 'Ki Teitzei',
387
- 'Ki Tavo',
388
- 'Nitzavim',
389
- 'Vayeilech',
390
- "Ha'azinu",
391
- 'Vezot Haberakhah',
392
- ];
393
- // 0-based parsha IDs
394
- const parsha2id = new Map();
395
- for (let id = 0; id < parshiot.length; id++) {
396
- const name = parshiot[id];
397
- parsha2id.set(name, id);
398
- }
399
- // 0-based parsha IDs
400
- const doubles = new Set([
401
- 21, // Vayakhel-Pekudei
402
- 26, // Tazria-Metzora
403
- 28, // Achrei Mot-Kedoshim
404
- 31, // Behar-Bechukotai
405
- 38, // Chukat-Balak
406
- 41, // Matot-Masei
407
- 50, // Nitzavim-Vayeilech
408
- ]);
409
- /**
410
- * @private
411
- * @param id a negative number
412
- */
413
- function isValidDouble(id) {
414
- return doubles.has(-id);
415
- }
416
- /**
417
- * parsha doubler/undoubler
418
- * @private
419
- * @param p
420
- */
421
- function D(p) {
422
- return -p;
423
- }
424
- const RH = 'Rosh Hashana'; // 0
425
- const YK = 'Yom Kippur'; // 1
426
- const SUKKOT = 'Sukkot'; // 0
427
- const CHMSUKOT = 'Sukkot Shabbat Chol ha-Moed'; // 0
428
- const SHMINI = 'Shmini Atzeret'; // 0
429
- const PESACH = 'Pesach'; // 25
430
- const PESACH1 = 'Pesach I';
431
- const CHMPESACH = 'Pesach Shabbat Chol ha-Moed'; // 25
432
- const PESACH7 = 'Pesach VII'; // 25
433
- const PESACH8 = 'Pesach VIII';
434
- const SHAVUOT = 'Shavuot'; // 33
435
- /**
436
- * Returns an array from start to end
437
- * @private
438
- * @param start beginning number, inclusive
439
- * @param stop ending number, inclusive
440
- */
441
- function range(start, stop) {
442
- return Array.from({ length: stop - start + 1 }, (v, k) => k + start);
443
- }
444
- const yearStartVayeilech = [51, 52, CHMSUKOT];
445
- const yearStartHaazinu = [52, YK, CHMSUKOT];
446
- const yearStartRH = [RH, 52, SUKKOT, SHMINI];
447
- const r020 = range(0, 20);
448
- const r027 = range(0, 27);
449
- const r3340 = range(33, 40);
450
- const r4349 = range(43, 49);
451
- const r4350 = range(43, 50);
452
- /**
453
- * The ordinary year types (keviot)
454
- * names are leap/nonleap - day - incomplete/regular/complete - diaspora/Israel
455
- * @private
456
- * @readonly
457
- */
458
- const types = {
459
- /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
460
- * Kislev each have 29 days), and has Passover start on Tuesday. */
461
- // e.g. 5753
462
- '020': yearStartVayeilech.concat(r020, D(21), 23, 24, CHMPESACH, 25, D(26), D(28), 30, D(31), r3340, D(41), r4349, D(50)),
463
- /* Hebrew year that starts on Monday, is `complete' (Heshvan and
464
- * Kislev each have 30 days), and has Passover start on Thursday. */
465
- // e.g. 5756
466
- '0220': yearStartVayeilech.concat(r020, D(21), 23, 24, CHMPESACH, 25, D(26), D(28), 30, D(31), 33, SHAVUOT, range(34, 37), D(38), 40, D(41), r4349, D(50)),
467
- /* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29
468
- * days and Kislev has 30 days), and has Passover start on Saturday. */
469
- // e.g. 5701
470
- '0510': yearStartHaazinu.concat(r020, D(21), 23, 24, PESACH1, PESACH8, 25, D(26), D(28), 30, D(31), r3340, D(41), r4350),
471
- /* Hebrew year that starts on Thursday, is `regular' (Heshvan has 29
472
- * days and Kislev has 30 days), and has Passover start on Saturday. */
473
- // e.g. 5745
474
- '0511': yearStartHaazinu.concat(r020, D(21), 23, 24, PESACH, 25, D(26), D(28), range(30, 40), D(41), r4350),
475
- /* Hebrew year that starts on Thursday, is `complete' (Heshvan and
476
- * Kislev each have 30 days), and has Passover start on Sunday. */
477
- // e.g. 5754
478
- '052': yearStartHaazinu.concat(range(0, 24), PESACH7, 25, D(26), D(28), 30, D(31), r3340, D(41), r4350),
479
- /* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and Kislev
480
- * each have 29 days), and has Passover start on Sunday. */
481
- // e.g. 5761
482
- '070': yearStartRH.concat(r020, D(21), 23, 24, PESACH7, 25, D(26), D(28), 30, D(31), r3340, D(41), r4350),
483
- /* Hebrew year that starts on Saturday, is `complete' (Heshvan and
484
- * Kislev each have 30 days), and has Passover start on Tuesday. */
485
- // e.g. 5716
486
- '072': yearStartRH.concat(r020, D(21), 23, 24, CHMPESACH, 25, D(26), D(28), 30, D(31), r3340, D(41), r4349, D(50)),
487
- /* -- The leap year types (keviot) -- */
488
- /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
489
- * Kislev each have 29 days), and has Passover start on Thursday. */
490
- // e.g. 5746
491
- '1200': yearStartVayeilech.concat(r027, CHMPESACH, range(28, 33), SHAVUOT, range(34, 37), D(38), 40, D(41), r4349, D(50)),
492
- /* Hebrew year that starts on Monday, is `incomplete' (Heshvan and
493
- * Kislev each have 29 days), and has Passover start on Thursday. */
494
- // e.g. 5746
495
- '1201': yearStartVayeilech.concat(r027, CHMPESACH, range(28, 40), D(41), r4349, D(50)),
496
- /* Hebrew year that starts on Monday, is `complete' (Heshvan and
497
- * Kislev each have 30 days), and has Passover start on Saturday. */
498
- // e.g.5752
499
- '1220': yearStartVayeilech.concat(r027, PESACH1, PESACH8, range(28, 40), D(41), r4350),
500
- /* Hebrew year that starts on Monday, is `complete' (Heshvan and
501
- * Kislev each have 30 days), and has Passover start on Saturday. */
502
- // e.g.5752
503
- '1221': yearStartVayeilech.concat(r027, PESACH, range(28, 50)),
504
- /* Hebrew year that starts on Thursday, is `incomplete' (Heshvan and
505
- * Kislev both have 29 days), and has Passover start on Sunday. */
506
- // e.g. 5768
507
- '150': yearStartHaazinu.concat(range(0, 28), PESACH7, range(29, 50)),
508
- /* Hebrew year that starts on Thursday, is `complete' (Heshvan and
509
- * Kislev both have 30 days), and has Passover start on Tuesday. */
510
- // eg. 5771
511
- '152': yearStartHaazinu.concat(range(0, 28), CHMPESACH, range(29, 49), D(50)),
512
- /* Hebrew year that starts on Saturday, is `incomplete' (Heshvan and
513
- * Kislev each have 29 days), and has Passover start on Tuesday. */
514
- // e.g.5757
515
- '170': yearStartRH.concat(r027, CHMPESACH, range(28, 40), D(41), r4349, D(50)),
516
- /* Hebrew year that starts on Saturday, is `complete' (Heshvan and
517
- * Kislev each have 30 days), and has Passover start on Thursday. */
518
- '1720': yearStartRH.concat(r027, CHMPESACH, range(28, 33), SHAVUOT, range(34, 37), D(38), 40, D(41), r4349, D(50)),
519
- };
520
- /* Hebrew year that starts on Monday, is `complete' (Heshvan and
521
- * Kislev each have 30 days), and has Passover start on Thursday. */
522
- types['0221'] = types['020'];
523
- /* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29
524
- * days and Kislev has 30 days), and has Passover start on Thursday. */
525
- // e.g. 5715
526
- types['0310'] = types['0220'];
527
- /* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29
528
- * days and Kislev has 30 days), and has Passover start on Thursday. */
529
- types['0311'] = types['020'];
530
- /* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29
531
- * days and Kislev has 30 days), and has Passover start on Saturday. */
532
- // e.g. 5715
533
- types['1310'] = types['1220'];
534
- /* Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29
535
- * days and Kislev has 30 days), and has Passover start on Saturday. */
536
- types['1311'] = types['1221'];
537
- /* Hebrew year that starts on Saturday, is `complete' (Heshvan and
538
- * Kislev each have 30 days), and has Passover start on Thursday. */
539
- types['1721'] = types['170'];
540
- const sedraCache = new QuickLRU({ maxSize: 120 });
541
- /**
542
- * Convenience function to create an instance of {@link Sedra} or reuse a
543
- * previously created and cached instance for the same year and schedule.
544
- *
545
- * Prefer this over `new Sedra(...)` when calling repeatedly — an internal
546
- * LRU cache (~120 entries) avoids recomputing the keviyah-specific schedule.
547
- * @example
548
- * import {getSedra, HDate, months} from '@hebcal/core';
549
- * const sedra = getSedra(5784, false);
550
- * const {parsha} = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));
551
- * console.log(parsha); // ['Lech-Lecha']
552
- * @param hyear Hebrew year
553
- * @param il Use Israel sedra schedule (`false` for Diaspora)
554
- */
555
- export function getSedra(hyear, il) {
556
- const cacheKey = `${hyear}-${il ? 1 : 0}`;
557
- let sedra = sedraCache.get(cacheKey);
558
- if (!sedra) {
559
- sedra = new Sedra(hyear, il);
560
- sedraCache.set(cacheKey, sedra);
561
- }
562
- return sedra;
563
- }
@@ -1,63 +0,0 @@
1
- {
2
- "ps67lines": [
3
- "אֱלֹהִים יְחָנֵּנוּ וִיבָרְכֵנוּ יָאֵר־פָּנָיו אִתָּנוּ סֶלָה",
4
- "לָדַעַת בָּאָרֶץ דַּרְכֶּךָ בְּכָל־גּוֹיִם יְשׁוּעָתֶךָ",
5
- "יוֹדוּךָ עַמִּים אֱלֹהִים יוֹדוּךָ עַמִּים כֻּלָּם",
6
- "יִשְׂמְחוּ וִירַנְּנוּ לְאֻמִּים כִּי־תִשְׁפֹּט עַמִּים מִישׁוֹר וּלְאֻמִּים בָּאָרֶץ תַּנחֵם סֶלָה",
7
- "יוֹדוּךָ עַמִּים אֱלֹהִים יוֹדוּךָ עַמִּים כֻּלָּם",
8
- "אֶרֶץ נָתְנָה יְבוּלָהּ יְבָרְכֵנוּ אֱלֹהִים אֱלֹהֵינוּ",
9
- "יְבָרְכֵנוּ אֱלֹהִים וְיִירְאוּ אוֹתוֹ כָּל־אַפְסֵי־אָרֶץ"
10
- ],
11
- "lamnatzeachLetters": "ישמחווירננולאמיםכיתשפוטעמיםמישורולאמיםבארץתנחםסלה",
12
- "anaBekoach": [
13
- "אָנָּא",
14
- "בְּכֹחַ",
15
- "גְּדֻלַּת",
16
- "יְמִינְךָ",
17
- "תַּתִּיר",
18
- "צְרוּרָה",
19
- "אב״ג ית״ץ",
20
- "קַבֵּל",
21
- "רִנַּת",
22
- "עַמְּךָ",
23
- "שַׂגְּבֵנוּ",
24
- "טַהֲרֵנוּ",
25
- "נוֹרָא",
26
- "קר״ע שט״ן",
27
- "נָא",
28
- "גִבּוֹר",
29
- "דּוֹרְשֵׁי",
30
- "יִחוּדְךָ",
31
- "כְּבָבַת",
32
- "שָׁמְרֵם",
33
- "נג״ד יכ״ש",
34
- "בָּרְכֵם",
35
- "טַהֲרֵם",
36
- "רַחֲמֵי",
37
- "צִדְקָתְךָ",
38
- "תָּמִיד",
39
- "גָּמְלֵם",
40
- "בט״ר צת״ג",
41
- "חֲסִין",
42
- "קָדוֹשׁ",
43
- "בְּרֹב",
44
- "טוּבְךָ",
45
- "נַהֵל",
46
- "עֲדָתֶךָ",
47
- "חק״ב תנ״ע",
48
- "יָחִיד",
49
- "גֵּאֶה",
50
- "לְעַמְּךָ",
51
- "פְּנֵה",
52
- "זוֹכְרֵי",
53
- "קְדֻשָּׁתֶךָ",
54
- "יג״ל פז״ק",
55
- "שַׁוְעָתֵנוּ",
56
- "קַבֵּל",
57
- "וּשְׁמַע",
58
- "צַעֲקָתֵנוּ",
59
- "יוֹדֵעַ",
60
- "תַּעֲלוּמוֹת",
61
- "שק״ו צי״ת"
62
- ]
63
- }