@hebcal/leyning 5.2.0 → 6.0.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.
package/README.md CHANGED
@@ -3,27 +3,10 @@ Javascript Torah Reading API for Parashat HaShavua and holidays
3
3
 
4
4
  [![Build Status](https://circleci.com/gh/hebcal/hebcal-leyning.svg?style=svg)](https://circleci.com/gh/hebcal/hebcal-leyning)
5
5
 
6
- This package includes both traditional (full kriyah), triennial and weekday
6
+ This package includes both traditional (full kriyah) and weekday
7
7
  Torah readings.
8
8
 
9
- “Many congregations pattern their weekly Torah reading cycle after a system
10
- similar to the one used in ancient Israel during the rabbinic period. In
11
- this system, the traditional parashiot are each divided into three shorter
12
- segments, and the whole Torah is completed once every three years. The
13
- system has both advantages and disadvantages, but its ability to shorten
14
- the length of Torah reading without sacrificing the complete reading of the
15
- Torah on a regular basis has made it the choice of some synagogues in the
16
- Conservative Movement.”
17
-
18
- [A Complete Triennial System for Reading the Torah, Committee on Jewish Law and Standards of the Rabbinical Assembly](https://www.rabbinicalassembly.org/sites/default/files/public/halakhah/teshuvot/19861990/eisenberg_triennial.pdf)
19
-
20
- Update December 2021: In November 2020, the CJLS modified the triennial
21
- cycle for some combined parshiyot to change the reading for year 3 to be
22
- the third section of the parashah.
23
-
24
- [Modification of the Triennial Cycle Readings for Combined Parashot in Certain Years](https://www.rabbinicalassembly.org/sites/default/files/2021-09/cohen-triennial.pdf), Rabbi Miles B. Cohen
25
-
26
- Update August 2022: Incorporated [An Emendation to Richard Eisenberg’s Complete Triennial System for Reading Torah, to Address a Rare Situation](https://www.rabbinicalassembly.org/sites/default/files/public/halakhah/teshuvot/2011-2020/heller-triennial-emendation.pdf), Rabbi Joshua Heller, 2012
9
+ Triennial Torah Readings have moved to [@hebcal/triennial](https://github.com/hebcal/hebcal-triennial)
27
10
 
28
11
  ## Installation
29
12
  ```bash
@@ -33,8 +16,7 @@ $ npm install @hebcal/leyning
33
16
  ## Synopsis
34
17
  ```javascript
35
18
  import {HebrewCalendar, HDate, Event} from '@hebcal/core';
36
- import {getLeyningForParshaHaShavua, getTriennialForParshaHaShavua,
37
- formatAliyahWithBook} from '@hebcal/leyning';
19
+ import {getLeyningForParshaHaShavua, formatAliyahWithBook} from '@hebcal/leyning';
38
20
 
39
21
  const events = HebrewCalendar.calendar({sedrot: true, noHolidays: true});
40
22
  const ev = events.find((ev) => ev.getDesc() == 'Parashat Pinchas');
@@ -50,22 +32,8 @@ for (const [num, aliyah] of Object.entries(reading.fullkriyah)) {
50
32
  str += ` (${aliyah.v} verses)`;
51
33
  console.log(`${number}: ${str}`);
52
34
  }
53
- const triReading = getTriennialForParshaHaShavua(ev);
54
- for (const [num, aliyah] of Object.entries(triReading)) {
55
- const number = num == 'M' ? 'maftir' : `aliyah ${num}`;
56
- const str = formatAliyahWithBook(aliyah);
57
- console.log(`Triennial ${number}: ${str}`);
58
- }
59
35
  ```
60
36
 
61
- ## Classes
62
-
63
- <dl>
64
- <dt><a href="#Triennial">Triennial</a></dt>
65
- <dd><p>Triennial Torah readings</p>
66
- </dd>
67
- </dl>
68
-
69
37
  ## Constants
70
38
 
71
39
  <dl>
@@ -120,6 +88,15 @@ e.g. <code>Genesis 21:1-34; Numbers 29:1-6</code>.</p>
120
88
  <dt><a href="#getLeyningKeyForEvent">getLeyningKeyForEvent(ev, [il])</a> ⇒ <code>string</code></dt>
121
89
  <dd><p>Based on the event date, type and title, finds the relevant leyning key</p>
122
90
  </dd>
91
+ <dt><a href="#specialReadings">specialReadings(hd, il, aliyot, reason)</a> ⇒ <code><a href="#Aliyah">Aliyah</a></code> | <code><a href="#Aliyah">Array.&lt;Aliyah&gt;</a></code></dt>
92
+ <dd><p>Determines if the regular parashat haShavua coincides with an event that requires
93
+ a special maftir or Haftara (for example Shabbat HaGadol, Shabbat Chanukah, Rosh
94
+ Chodesh or Machar Chodesh, etc.).</p>
95
+ <p>If a special maftir occurs, modifies <code>aliyot</code> to replace <code>M</code> and sets <code>reason.M</code>
96
+ (and in some cases modifies the 6th and 7th aliyah, setting <code>reason[&#39;7&#39;]</code>).</p>
97
+ <p>If a special Haftarah applies, returns the Haftarah object and sets <code>reason.haftara</code>.
98
+ If no special Haftarah, returns <code>undefined</code></p>
99
+ </dd>
123
100
  <dt><a href="#getLeyningForHoliday">getLeyningForHoliday(ev, [il])</a> ⇒ <code><a href="#Leyning">Leyning</a></code></dt>
124
101
  <dd><p>Looks up leyning for a given holiday. Returns some
125
102
  of full kriyah aliyot, special Maftir, special Haftarah</p>
@@ -148,14 +125,8 @@ Parashat haShavua, containing only the <code>weekday</code> aliyot (no <code>ful
148
125
  <dt><a href="#lookupParsha">lookupParsha(parsha)</a> ⇒ <code><a href="#ParshaMeta">ParshaMeta</a></code></dt>
149
126
  <dd><p>Returns the parsha metadata</p>
150
127
  </dd>
151
- <dt><a href="#getTriennial">getTriennial(year)</a> ⇒ <code><a href="#Triennial">Triennial</a></code></dt>
152
- <dd><p>Calculates the 3-year readings for a given year</p>
153
- </dd>
154
- <dt><a href="#getTriennialForParshaHaShavua">getTriennialForParshaHaShavua(ev)</a> ⇒ <code><a href="#TriennialAliyot">TriennialAliyot</a></code></dt>
155
- <dd><p>Looks up the triennial leyning for this Parashat HaShavua</p>
156
- </dd>
157
- <dt><a href="#getTriennialHaftaraForHoliday">getTriennialHaftaraForHoliday(key, yearNum)</a> ⇒ <code>Object</code></dt>
158
- <dd><p>Looks up the alternative triennial Haftara for a holiday</p>
128
+ <dt><a href="#writeCsvLines">writeCsvLines(stream, ev, reading, il, isParsha)</a></dt>
129
+ <dd><p>Formats reading for CSV</p>
159
130
  </dd>
160
131
  </dl>
161
132
 
@@ -174,79 +145,8 @@ Parashat haShavua, containing only the <code>weekday</code> aliyot (no <code>ful
174
145
  <dt><a href="#ParshaMeta">ParshaMeta</a> : <code>Object</code></dt>
175
146
  <dd><p>Parsha metadata</p>
176
147
  </dd>
177
- <dt><a href="#TriennialAliyot">TriennialAliyot</a> : <code>Object</code></dt>
178
- <dd><p>Represents triennial aliyot for a given date</p>
179
- </dd>
180
148
  </dl>
181
149
 
182
- <a name="Triennial"></a>
183
-
184
- ## Triennial
185
- Triennial Torah readings
186
-
187
- **Kind**: global class
188
-
189
- * [Triennial](#Triennial)
190
- * [new Triennial([hebrewYear])](#new_Triennial_new)
191
- * _instance_
192
- * [.getReading(parsha, yearNum)](#Triennial+getReading) ⇒ <code>Object.&lt;string, Aliyah&gt;</code>
193
- * [.getStartYear()](#Triennial+getStartYear) ⇒ <code>number</code>
194
- * [.debug()](#Triennial+debug) ⇒ <code>string</code>
195
- * _static_
196
- * [.getYearNumber(year)](#Triennial.getYearNumber) ⇒ <code>number</code>
197
- * [.getCycleStartYear(year)](#Triennial.getCycleStartYear) ⇒ <code>number</code>
198
-
199
- <a name="new_Triennial_new"></a>
200
-
201
- ### new Triennial([hebrewYear])
202
- Builds a Triennial object
203
-
204
-
205
- | Param | Type | Description |
206
- | --- | --- | --- |
207
- | [hebrewYear] | <code>number</code> | Hebrew Year (default current year) |
208
-
209
- <a name="Triennial+getReading"></a>
210
-
211
- ### triennial.getReading(parsha, yearNum) ⇒ <code>Object.&lt;string, Aliyah&gt;</code>
212
- **Kind**: instance method of [<code>Triennial</code>](#Triennial)
213
- **Returns**: <code>Object.&lt;string, Aliyah&gt;</code> - a map of aliyot 1-7 plus "M"
214
-
215
- | Param | Type | Description |
216
- | --- | --- | --- |
217
- | parsha | <code>string</code> | parsha name ("Bereshit" or "Achrei Mot-Kedoshim") |
218
- | yearNum | <code>number</code> | 0 through 2 for which year of Triennial cycle |
219
-
220
- <a name="Triennial+getStartYear"></a>
221
-
222
- ### triennial.getStartYear() ⇒ <code>number</code>
223
- **Kind**: instance method of [<code>Triennial</code>](#Triennial)
224
- <a name="Triennial+debug"></a>
225
-
226
- ### triennial.debug() ⇒ <code>string</code>
227
- **Kind**: instance method of [<code>Triennial</code>](#Triennial)
228
- <a name="Triennial.getYearNumber"></a>
229
-
230
- ### Triennial.getYearNumber(year) ⇒ <code>number</code>
231
- Returns triennial year 1, 2 or 3 based on this Hebrew year
232
-
233
- **Kind**: static method of [<code>Triennial</code>](#Triennial)
234
-
235
- | Param | Type | Description |
236
- | --- | --- | --- |
237
- | year | <code>number</code> | Hebrew year |
238
-
239
- <a name="Triennial.getCycleStartYear"></a>
240
-
241
- ### Triennial.getCycleStartYear(year) ⇒ <code>number</code>
242
- Returns Hebrew year that this 3-year triennial cycle began
243
-
244
- **Kind**: static method of [<code>Triennial</code>](#Triennial)
245
-
246
- | Param | Type | Description |
247
- | --- | --- | --- |
248
- | year | <code>number</code> | Hebrew year |
249
-
250
150
  <a name="BOOK"></a>
251
151
 
252
152
  ## BOOK : <code>Array.&lt;string&gt;</code>
@@ -348,7 +248,7 @@ e.g. `Genesis 21:1-34; Numbers 29:1-6`.
348
248
 
349
249
  | Param | Type |
350
250
  | --- | --- |
351
- | parts | [<code>Array.&lt;Aliyah&gt;</code>](#Aliyah) |
251
+ | parts | [<code>Aliyah</code>](#Aliyah) \| [<code>Array.&lt;Aliyah&gt;</code>](#Aliyah) |
352
252
 
353
253
  <a name="makeLeyningSummary"></a>
354
254
 
@@ -396,6 +296,28 @@ Based on the event date, type and title, finds the relevant leyning key
396
296
  | ev | <code>Event</code> | | event |
397
297
  | [il] | <code>boolean</code> | <code>false</code> | true if Israel holiday scheme |
398
298
 
299
+ <a name="specialReadings"></a>
300
+
301
+ ## specialReadings(hd, il, aliyot, reason) ⇒ [<code>Aliyah</code>](#Aliyah) \| [<code>Array.&lt;Aliyah&gt;</code>](#Aliyah)
302
+ Determines if the regular parashat haShavua coincides with an event that requires
303
+ a special maftir or Haftara (for example Shabbat HaGadol, Shabbat Chanukah, Rosh
304
+ Chodesh or Machar Chodesh, etc.).
305
+
306
+ If a special maftir occurs, modifies `aliyot` to replace `M` and sets `reason.M`
307
+ (and in some cases modifies the 6th and 7th aliyah, setting `reason['7']`).
308
+
309
+ If a special Haftarah applies, returns the Haftarah object and sets `reason.haftara`.
310
+ If no special Haftarah, returns `undefined`
311
+
312
+ **Kind**: global function
313
+
314
+ | Param | Type |
315
+ | --- | --- |
316
+ | hd | <code>HDate</code> |
317
+ | il | <code>boolean</code> |
318
+ | aliyot | <code>Object.&lt;string, Aliyah&gt;</code> |
319
+ | reason | <code>Object.&lt;string, string&gt;</code> |
320
+
399
321
  <a name="getLeyningForHoliday"></a>
400
322
 
401
323
  ## getLeyningForHoliday(ev, [il]) ⇒ [<code>Leyning</code>](#Leyning)
@@ -489,40 +411,20 @@ Returns the parsha metadata
489
411
  | --- | --- |
490
412
  | parsha | <code>string</code> \| <code>Array.&lt;string&gt;</code> |
491
413
 
492
- <a name="getTriennial"></a>
493
-
494
- ## getTriennial(year) ⇒ [<code>Triennial</code>](#Triennial)
495
- Calculates the 3-year readings for a given year
496
-
497
- **Kind**: global function
498
-
499
- | Param | Type | Description |
500
- | --- | --- | --- |
501
- | year | <code>number</code> | Hebrew year |
414
+ <a name="writeCsvLines"></a>
502
415
 
503
- <a name="getTriennialForParshaHaShavua"></a>
504
-
505
- ## getTriennialForParshaHaShavua(ev) ⇒ [<code>TriennialAliyot</code>](#TriennialAliyot)
506
- Looks up the triennial leyning for this Parashat HaShavua
416
+ ## writeCsvLines(stream, ev, reading, il, isParsha)
417
+ Formats reading for CSV
507
418
 
508
419
  **Kind**: global function
509
- **Returns**: [<code>TriennialAliyot</code>](#TriennialAliyot) - a map of aliyot 1-7 plus "M"
510
420
 
511
421
  | Param | Type |
512
422
  | --- | --- |
423
+ | stream | <code>fs.WriteStream</code> |
513
424
  | ev | <code>Event</code> |
514
-
515
- <a name="getTriennialHaftaraForHoliday"></a>
516
-
517
- ## getTriennialHaftaraForHoliday(key, yearNum) ⇒ <code>Object</code>
518
- Looks up the alternative triennial Haftara for a holiday
519
-
520
- **Kind**: global function
521
-
522
- | Param | Type |
523
- | --- | --- |
524
- | key | <code>string</code> |
525
- | yearNum | <code>number</code> |
425
+ | reading | [<code>Leyning</code>](#Leyning) |
426
+ | il | <code>boolean</code> |
427
+ | isParsha | <code>boolean</code> |
526
428
 
527
429
  <a name="Aliyah"></a>
528
430
 
@@ -594,20 +496,3 @@ Parsha metadata
594
496
  | [seph] | [<code>Aliyah</code>](#Aliyah) \| [<code>Array.&lt;Aliyah&gt;</code>](#Aliyah) | Haftarah object(s) for Sephardim |
595
497
  | fullkriyah | <code>Object.&lt;string, Array.&lt;string&gt;&gt;</code> | Map of aliyot `1` through `7` plus `M` for maftir |
596
498
  | weekday | <code>Object.&lt;string, Array.&lt;string&gt;&gt;</code> | Map of weekday Torah Readings aliyot `1` through `3` for Monday and Thursday |
597
-
598
- <a name="TriennialAliyot"></a>
599
-
600
- ## TriennialAliyot : <code>Object</code>
601
- Represents triennial aliyot for a given date
602
-
603
- **Kind**: global typedef
604
- **Properties**
605
-
606
- | Name | Type | Description |
607
- | --- | --- | --- |
608
- | aliyot | <code>Object.&lt;string, Aliyah&gt;</code> | a map of aliyot 1-7 plus "M" |
609
- | yearNum | <code>number</code> | year number, 0-2 |
610
- | date | <code>Date</code> | Shabbat date for when this parsha is read in this 3-year cycle |
611
- | [readSeparately] | <code>boolean</code> | true if a double parsha is read separately in year `yearNum` |
612
- | [date1] | <code>Date</code> | Shabbat date of the first part of a read-separately aliyah pair |
613
- | [date2] | <code>Date</code> | Shabbat date of the second part of a read-separately aliyah pair |