@hebcal/leyning 4.20.1 → 5.2.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 +184 -42
- package/dist/bundle.js +611 -1519
- package/dist/bundle.min.js +2 -2
- package/dist/index.js +250 -292
- package/dist/index.mjs +249 -285
- package/leyning.d.ts +61 -28
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ for (const [num, aliyah] of Object.entries(triReading)) {
|
|
|
69
69
|
## Constants
|
|
70
70
|
|
|
71
71
|
<dl>
|
|
72
|
-
<dt><a href="#BOOK">BOOK</a></dt>
|
|
72
|
+
<dt><a href="#BOOK">BOOK</a> : <code>Array.<string></code></dt>
|
|
73
73
|
<dd><p>Names of the books of the Torah. BOOK[1] === 'Genesis'</p>
|
|
74
74
|
</dd>
|
|
75
75
|
</dl>
|
|
@@ -77,9 +77,16 @@ for (const [num, aliyah] of Object.entries(triReading)) {
|
|
|
77
77
|
## Functions
|
|
78
78
|
|
|
79
79
|
<dl>
|
|
80
|
-
<dt><
|
|
81
|
-
<dd><p>
|
|
82
|
-
|
|
80
|
+
<dt><a href="#parshaToString">parshaToString(parsha)</a> ⇒ <code>string</code></dt>
|
|
81
|
+
<dd><p>Formats parsha as a string</p>
|
|
82
|
+
</dd>
|
|
83
|
+
<dt><a href="#clone">clone(src)</a> ⇒ <code>any</code></dt>
|
|
84
|
+
<dd><p>Makes a deep copy of the src object using JSON stringify and parse</p>
|
|
85
|
+
</dd>
|
|
86
|
+
<dt><a href="#calculateNumVerses">calculateNumVerses(aliyah)</a> ⇒ <code>number</code></dt>
|
|
87
|
+
<dd><p>Calculates the number of verses in an aliyah or haftara based on
|
|
88
|
+
the <code>b</code> (begin verse), <code>e</code> (end verse) and <code>k</code> (book).
|
|
89
|
+
Modifies <code>aliyah</code> by setting the <code>v</code> field.</p>
|
|
83
90
|
</dd>
|
|
84
91
|
<dt><a href="#formatAliyahWithBook">formatAliyahWithBook(a)</a> ⇒ <code>string</code></dt>
|
|
85
92
|
<dd><p>Formats an aliyah object like "Numbers 28:9-28:15"</p>
|
|
@@ -87,16 +94,36 @@ CAUTION: Modifies the <code>aliyot</code> parameter instead of making a copy.</p
|
|
|
87
94
|
<dt><a href="#formatAliyahShort">formatAliyahShort(aliyah, showBook)</a> ⇒ <code>string</code></dt>
|
|
88
95
|
<dd><p>Formats an aliyah object like "Numbers 28:9-15"</p>
|
|
89
96
|
</dd>
|
|
90
|
-
<dt><a href="#
|
|
91
|
-
<dd><p>
|
|
97
|
+
<dt><a href="#sumVerses">sumVerses(aliyot)</a> ⇒ <code>number</code></dt>
|
|
98
|
+
<dd><p>Returns the total number of verses in an array of Aliyah (or haftarah) objects</p>
|
|
92
99
|
</dd>
|
|
93
|
-
<dt><a href="#
|
|
94
|
-
<dd><p>
|
|
95
|
-
|
|
100
|
+
<dt><a href="#makeLeyningParts">makeLeyningParts(aliyot)</a> ⇒ <code><a href="#Aliyah">Array.<Aliyah></a></code></dt>
|
|
101
|
+
<dd><p>Summarizes an <code>AliyotMap</code> by collapsing all adjacent aliyot.
|
|
102
|
+
Finds any non-overlapping parts (e.g. special 7th aliyah or maftir)</p>
|
|
103
|
+
</dd>
|
|
104
|
+
<dt><a href="#makeSummaryFromParts">makeSummaryFromParts(parts)</a> ⇒ <code>string</code></dt>
|
|
105
|
+
<dd><p>Returns a string representation of the leyning parts.
|
|
106
|
+
Separate verse ranges read from the same book are separated
|
|
107
|
+
by commas, e.g. <code>Isaiah 6:1-7:6, 9:5-6</code>.
|
|
108
|
+
Verse ranges from different books are separated by semicolons,
|
|
109
|
+
e.g. <code>Genesis 21:1-34; Numbers 29:1-6</code>.</p>
|
|
96
110
|
</dd>
|
|
97
111
|
<dt><a href="#makeLeyningSummary">makeLeyningSummary(aliyot)</a> ⇒ <code>string</code></dt>
|
|
98
112
|
<dd><p>Makes a summary of the leyning, like "Genesis 6:9-11:32"</p>
|
|
99
113
|
</dd>
|
|
114
|
+
<dt><a href="#hasFestival">hasFestival(holiday)</a> ⇒ <code>boolean</code></dt>
|
|
115
|
+
<dd><p>Is there a special festival Torah Reading for <code>holiday</code>?</p>
|
|
116
|
+
</dd>
|
|
117
|
+
<dt><a href="#lookupFestival">lookupFestival(holiday)</a> ⇒ <code>any</code></dt>
|
|
118
|
+
<dd><p>Returns the raw metadata for festival reading for <code>holiday</code></p>
|
|
119
|
+
</dd>
|
|
120
|
+
<dt><a href="#getLeyningKeyForEvent">getLeyningKeyForEvent(ev, [il])</a> ⇒ <code>string</code></dt>
|
|
121
|
+
<dd><p>Based on the event date, type and title, finds the relevant leyning key</p>
|
|
122
|
+
</dd>
|
|
123
|
+
<dt><a href="#getLeyningForHoliday">getLeyningForHoliday(ev, [il])</a> ⇒ <code><a href="#Leyning">Leyning</a></code></dt>
|
|
124
|
+
<dd><p>Looks up leyning for a given holiday. Returns some
|
|
125
|
+
of full kriyah aliyot, special Maftir, special Haftarah</p>
|
|
126
|
+
</dd>
|
|
100
127
|
<dt><a href="#getLeyningForHolidayKey">getLeyningForHolidayKey(key, [cholHaMoedDay])</a> ⇒ <code><a href="#Leyning">Leyning</a></code></dt>
|
|
101
128
|
<dd><p>Looks up leyning for a given holiday key. Key should be an
|
|
102
129
|
(untranslated) string used in holiday-readings.json. Returns some
|
|
@@ -118,10 +145,13 @@ reading for that day (see <a href="#getLeyningForHoliday">getLeyningForHoliday</
|
|
|
118
145
|
Parashat haShavua, containing only the <code>weekday</code> aliyot (no <code>fullkriyah</code>).</p>
|
|
119
146
|
<p>Otherwise, returns <code>undefined</code>.</p>
|
|
120
147
|
</dd>
|
|
148
|
+
<dt><a href="#lookupParsha">lookupParsha(parsha)</a> ⇒ <code><a href="#ParshaMeta">ParshaMeta</a></code></dt>
|
|
149
|
+
<dd><p>Returns the parsha metadata</p>
|
|
150
|
+
</dd>
|
|
121
151
|
<dt><a href="#getTriennial">getTriennial(year)</a> ⇒ <code><a href="#Triennial">Triennial</a></code></dt>
|
|
122
152
|
<dd><p>Calculates the 3-year readings for a given year</p>
|
|
123
153
|
</dd>
|
|
124
|
-
<dt><a href="#getTriennialForParshaHaShavua">getTriennialForParshaHaShavua(ev
|
|
154
|
+
<dt><a href="#getTriennialForParshaHaShavua">getTriennialForParshaHaShavua(ev)</a> ⇒ <code><a href="#TriennialAliyot">TriennialAliyot</a></code></dt>
|
|
125
155
|
<dd><p>Looks up the triennial leyning for this Parashat HaShavua</p>
|
|
126
156
|
</dd>
|
|
127
157
|
<dt><a href="#getTriennialHaftaraForHoliday">getTriennialHaftaraForHoliday(key, yearNum)</a> ⇒ <code>Object</code></dt>
|
|
@@ -141,6 +171,9 @@ Parashat haShavua, containing only the <code>weekday</code> aliyot (no <code>ful
|
|
|
141
171
|
<dt><a href="#Leyning">Leyning</a> : <code>Object</code></dt>
|
|
142
172
|
<dd><p>Leyning for a parsha hashavua or holiday</p>
|
|
143
173
|
</dd>
|
|
174
|
+
<dt><a href="#ParshaMeta">ParshaMeta</a> : <code>Object</code></dt>
|
|
175
|
+
<dd><p>Parsha metadata</p>
|
|
176
|
+
</dd>
|
|
144
177
|
<dt><a href="#TriennialAliyot">TriennialAliyot</a> : <code>Object</code></dt>
|
|
145
178
|
<dd><p>Represents triennial aliyot for a given date</p>
|
|
146
179
|
</dd>
|
|
@@ -216,24 +249,45 @@ Returns Hebrew year that this 3-year triennial cycle began
|
|
|
216
249
|
|
|
217
250
|
<a name="BOOK"></a>
|
|
218
251
|
|
|
219
|
-
## BOOK
|
|
252
|
+
## BOOK : <code>Array.<string></code>
|
|
220
253
|
Names of the books of the Torah. BOOK[1] === 'Genesis'
|
|
221
254
|
|
|
222
255
|
**Kind**: global constant
|
|
223
|
-
|
|
256
|
+
**Read only**: true
|
|
257
|
+
<a name="parshaToString"></a>
|
|
224
258
|
|
|
225
|
-
##
|
|
226
|
-
|
|
259
|
+
## parshaToString(parsha) ⇒ <code>string</code>
|
|
260
|
+
Formats parsha as a string
|
|
227
261
|
|
|
228
|
-
|
|
229
|
-
|
|
262
|
+
**Kind**: global function
|
|
263
|
+
|
|
264
|
+
| Param | Type |
|
|
265
|
+
| --- | --- |
|
|
266
|
+
| parsha | <code>Array.<string></code> |
|
|
267
|
+
|
|
268
|
+
<a name="clone"></a>
|
|
269
|
+
|
|
270
|
+
## clone(src) ⇒ <code>any</code>
|
|
271
|
+
Makes a deep copy of the src object using JSON stringify and parse
|
|
230
272
|
|
|
231
273
|
**Kind**: global function
|
|
232
274
|
|
|
233
|
-
| Param | Type |
|
|
234
|
-
| --- | --- |
|
|
235
|
-
|
|
|
236
|
-
|
|
275
|
+
| Param | Type |
|
|
276
|
+
| --- | --- |
|
|
277
|
+
| src | <code>any</code> |
|
|
278
|
+
|
|
279
|
+
<a name="calculateNumVerses"></a>
|
|
280
|
+
|
|
281
|
+
## calculateNumVerses(aliyah) ⇒ <code>number</code>
|
|
282
|
+
Calculates the number of verses in an aliyah or haftara based on
|
|
283
|
+
the `b` (begin verse), `e` (end verse) and `k` (book).
|
|
284
|
+
Modifies `aliyah` by setting the `v` field.
|
|
285
|
+
|
|
286
|
+
**Kind**: global function
|
|
287
|
+
|
|
288
|
+
| Param | Type |
|
|
289
|
+
| --- | --- |
|
|
290
|
+
| aliyah | [<code>Aliyah</code>](#Aliyah) |
|
|
237
291
|
|
|
238
292
|
<a name="formatAliyahWithBook"></a>
|
|
239
293
|
|
|
@@ -258,9 +312,80 @@ Formats an aliyah object like "Numbers 28:9-15"
|
|
|
258
312
|
| aliyah | [<code>Aliyah</code>](#Aliyah) |
|
|
259
313
|
| showBook | <code>boolean</code> |
|
|
260
314
|
|
|
315
|
+
<a name="sumVerses"></a>
|
|
316
|
+
|
|
317
|
+
## sumVerses(aliyot) ⇒ <code>number</code>
|
|
318
|
+
Returns the total number of verses in an array of Aliyah (or haftarah) objects
|
|
319
|
+
|
|
320
|
+
**Kind**: global function
|
|
321
|
+
|
|
322
|
+
| Param | Type |
|
|
323
|
+
| --- | --- |
|
|
324
|
+
| aliyot | [<code>Aliyah</code>](#Aliyah) \| [<code>Array.<Aliyah></code>](#Aliyah) |
|
|
325
|
+
|
|
326
|
+
<a name="makeLeyningParts"></a>
|
|
327
|
+
|
|
328
|
+
## makeLeyningParts(aliyot) ⇒ [<code>Array.<Aliyah></code>](#Aliyah)
|
|
329
|
+
Summarizes an `AliyotMap` by collapsing all adjacent aliyot.
|
|
330
|
+
Finds any non-overlapping parts (e.g. special 7th aliyah or maftir)
|
|
331
|
+
|
|
332
|
+
**Kind**: global function
|
|
333
|
+
|
|
334
|
+
| Param | Type |
|
|
335
|
+
| --- | --- |
|
|
336
|
+
| aliyot | <code>Object.<string, Aliyah></code> |
|
|
337
|
+
|
|
338
|
+
<a name="makeSummaryFromParts"></a>
|
|
339
|
+
|
|
340
|
+
## makeSummaryFromParts(parts) ⇒ <code>string</code>
|
|
341
|
+
Returns a string representation of the leyning parts.
|
|
342
|
+
Separate verse ranges read from the same book are separated
|
|
343
|
+
by commas, e.g. `Isaiah 6:1-7:6, 9:5-6`.
|
|
344
|
+
Verse ranges from different books are separated by semicolons,
|
|
345
|
+
e.g. `Genesis 21:1-34; Numbers 29:1-6`.
|
|
346
|
+
|
|
347
|
+
**Kind**: global function
|
|
348
|
+
|
|
349
|
+
| Param | Type |
|
|
350
|
+
| --- | --- |
|
|
351
|
+
| parts | [<code>Array.<Aliyah></code>](#Aliyah) |
|
|
352
|
+
|
|
353
|
+
<a name="makeLeyningSummary"></a>
|
|
354
|
+
|
|
355
|
+
## makeLeyningSummary(aliyot) ⇒ <code>string</code>
|
|
356
|
+
Makes a summary of the leyning, like "Genesis 6:9-11:32"
|
|
357
|
+
|
|
358
|
+
**Kind**: global function
|
|
359
|
+
|
|
360
|
+
| Param | Type |
|
|
361
|
+
| --- | --- |
|
|
362
|
+
| aliyot | <code>Object.<string, Aliyah></code> |
|
|
363
|
+
|
|
364
|
+
<a name="hasFestival"></a>
|
|
365
|
+
|
|
366
|
+
## hasFestival(holiday) ⇒ <code>boolean</code>
|
|
367
|
+
Is there a special festival Torah Reading for `holiday`?
|
|
368
|
+
|
|
369
|
+
**Kind**: global function
|
|
370
|
+
|
|
371
|
+
| Param | Type |
|
|
372
|
+
| --- | --- |
|
|
373
|
+
| holiday | <code>string</code> |
|
|
374
|
+
|
|
375
|
+
<a name="lookupFestival"></a>
|
|
376
|
+
|
|
377
|
+
## lookupFestival(holiday) ⇒ <code>any</code>
|
|
378
|
+
Returns the raw metadata for festival reading for `holiday`
|
|
379
|
+
|
|
380
|
+
**Kind**: global function
|
|
381
|
+
|
|
382
|
+
| Param | Type |
|
|
383
|
+
| --- | --- |
|
|
384
|
+
| holiday | <code>string</code> |
|
|
385
|
+
|
|
261
386
|
<a name="getLeyningKeyForEvent"></a>
|
|
262
387
|
|
|
263
|
-
## getLeyningKeyForEvent(
|
|
388
|
+
## getLeyningKeyForEvent(ev, [il]) ⇒ <code>string</code>
|
|
264
389
|
Based on the event date, type and title, finds the relevant leyning key
|
|
265
390
|
|
|
266
391
|
**Kind**: global function
|
|
@@ -268,12 +393,12 @@ Based on the event date, type and title, finds the relevant leyning key
|
|
|
268
393
|
|
|
269
394
|
| Param | Type | Default | Description |
|
|
270
395
|
| --- | --- | --- | --- |
|
|
271
|
-
|
|
|
396
|
+
| ev | <code>Event</code> | | event |
|
|
272
397
|
| [il] | <code>boolean</code> | <code>false</code> | true if Israel holiday scheme |
|
|
273
398
|
|
|
274
399
|
<a name="getLeyningForHoliday"></a>
|
|
275
400
|
|
|
276
|
-
## getLeyningForHoliday(
|
|
401
|
+
## getLeyningForHoliday(ev, [il]) ⇒ [<code>Leyning</code>](#Leyning)
|
|
277
402
|
Looks up leyning for a given holiday. Returns some
|
|
278
403
|
of full kriyah aliyot, special Maftir, special Haftarah
|
|
279
404
|
|
|
@@ -282,20 +407,9 @@ of full kriyah aliyot, special Maftir, special Haftarah
|
|
|
282
407
|
|
|
283
408
|
| Param | Type | Default | Description |
|
|
284
409
|
| --- | --- | --- | --- |
|
|
285
|
-
|
|
|
410
|
+
| ev | <code>Event</code> | | the Hebcal event associated with this leyning |
|
|
286
411
|
| [il] | <code>boolean</code> | <code>false</code> | true if Israel holiday scheme |
|
|
287
412
|
|
|
288
|
-
<a name="makeLeyningSummary"></a>
|
|
289
|
-
|
|
290
|
-
## makeLeyningSummary(aliyot) ⇒ <code>string</code>
|
|
291
|
-
Makes a summary of the leyning, like "Genesis 6:9-11:32"
|
|
292
|
-
|
|
293
|
-
**Kind**: global function
|
|
294
|
-
|
|
295
|
-
| Param | Type |
|
|
296
|
-
| --- | --- |
|
|
297
|
-
| aliyot | <code>Object.<string, Aliyah></code> |
|
|
298
|
-
|
|
299
413
|
<a name="getLeyningForHolidayKey"></a>
|
|
300
414
|
|
|
301
415
|
## getLeyningForHolidayKey(key, [cholHaMoedDay]) ⇒ [<code>Leyning</code>](#Leyning)
|
|
@@ -364,6 +478,17 @@ Otherwise, returns `undefined`.
|
|
|
364
478
|
| hdate | <code>HDate</code> | Hebrew Date |
|
|
365
479
|
| il | <code>boolean</code> | in Israel |
|
|
366
480
|
|
|
481
|
+
<a name="lookupParsha"></a>
|
|
482
|
+
|
|
483
|
+
## lookupParsha(parsha) ⇒ [<code>ParshaMeta</code>](#ParshaMeta)
|
|
484
|
+
Returns the parsha metadata
|
|
485
|
+
|
|
486
|
+
**Kind**: global function
|
|
487
|
+
|
|
488
|
+
| Param | Type |
|
|
489
|
+
| --- | --- |
|
|
490
|
+
| parsha | <code>string</code> \| <code>Array.<string></code> |
|
|
491
|
+
|
|
367
492
|
<a name="getTriennial"></a>
|
|
368
493
|
|
|
369
494
|
## getTriennial(year) ⇒ [<code>Triennial</code>](#Triennial)
|
|
@@ -377,16 +502,15 @@ Calculates the 3-year readings for a given year
|
|
|
377
502
|
|
|
378
503
|
<a name="getTriennialForParshaHaShavua"></a>
|
|
379
504
|
|
|
380
|
-
## getTriennialForParshaHaShavua(ev
|
|
505
|
+
## getTriennialForParshaHaShavua(ev) ⇒ [<code>TriennialAliyot</code>](#TriennialAliyot)
|
|
381
506
|
Looks up the triennial leyning for this Parashat HaShavua
|
|
382
507
|
|
|
383
508
|
**Kind**: global function
|
|
384
|
-
**Returns**: [<code>TriennialAliyot</code>](#TriennialAliyot)
|
|
509
|
+
**Returns**: [<code>TriennialAliyot</code>](#TriennialAliyot) - a map of aliyot 1-7 plus "M"
|
|
385
510
|
|
|
386
|
-
| Param | Type |
|
|
387
|
-
| --- | --- |
|
|
388
|
-
| ev | <code>Event</code> |
|
|
389
|
-
| [context] | <code>boolean</code> | <code>false</code> | returns a reading wrapper object which includes `date`, `yearNum` and `aliyot` |
|
|
511
|
+
| Param | Type |
|
|
512
|
+
| --- | --- |
|
|
513
|
+
| ev | <code>Event</code> |
|
|
390
514
|
|
|
391
515
|
<a name="getTriennialHaftaraForHoliday"></a>
|
|
392
516
|
|
|
@@ -441,7 +565,7 @@ Leyning for a parsha hashavua or holiday
|
|
|
441
565
|
| --- | --- | --- |
|
|
442
566
|
| name | [<code>LeyningNames</code>](#LeyningNames) | |
|
|
443
567
|
| [parsha] | <code>Array.<string></code> | An array of either 1 (regular) or 2 (doubled parsha). `undefined` for holiday readings |
|
|
444
|
-
| [parshaNum] | <code>
|
|
568
|
+
| [parshaNum] | <code>number</code> | 1 for Bereshit, 2 for Noach, etc. `undefined` for holiday readings |
|
|
445
569
|
| summary | <code>string</code> | Such as `Genesis 1:1 - 6:8` |
|
|
446
570
|
| haft | [<code>Aliyah</code>](#Aliyah) \| [<code>Array.<Aliyah></code>](#Aliyah) | Haftarah object(s) |
|
|
447
571
|
| haftara | <code>string</code> | Haftarah, such as `Isaiah 42:5 – 43:11` |
|
|
@@ -453,6 +577,24 @@ Leyning for a parsha hashavua or holiday
|
|
|
453
577
|
| [weekday] | <code>Object.<string, Aliyah></code> | Optional map of weekday Torah Readings aliyot `1` through `3` for Monday and Thursday |
|
|
454
578
|
| [reason] | <code>Object.<string, string></code> | Explanations for special readings, keyed by aliyah number, `M` for maftir or `haftara` for Haftarah |
|
|
455
579
|
|
|
580
|
+
<a name="ParshaMeta"></a>
|
|
581
|
+
|
|
582
|
+
## ParshaMeta : <code>Object</code>
|
|
583
|
+
Parsha metadata
|
|
584
|
+
|
|
585
|
+
**Kind**: global typedef
|
|
586
|
+
**Properties**
|
|
587
|
+
|
|
588
|
+
| Name | Type | Description |
|
|
589
|
+
| --- | --- | --- |
|
|
590
|
+
| num | <code>number</code> | 1 for Bereshit, 2 for Noach, etc. `undefined` for holiday readings |
|
|
591
|
+
| hebrew | <code>string</code> | parsha name in Hebrew with niqud |
|
|
592
|
+
| book | <code>number</code> | 1 for Genesis, 2 for Exodus, 5 for Deuteronomy |
|
|
593
|
+
| haft | [<code>Aliyah</code>](#Aliyah) \| [<code>Array.<Aliyah></code>](#Aliyah) | Haftarah object(s) |
|
|
594
|
+
| [seph] | [<code>Aliyah</code>](#Aliyah) \| [<code>Array.<Aliyah></code>](#Aliyah) | Haftarah object(s) for Sephardim |
|
|
595
|
+
| fullkriyah | <code>Object.<string, Array.<string>></code> | Map of aliyot `1` through `7` plus `M` for maftir |
|
|
596
|
+
| weekday | <code>Object.<string, Array.<string>></code> | Map of weekday Torah Readings aliyot `1` through `3` for Monday and Thursday |
|
|
597
|
+
|
|
456
598
|
<a name="TriennialAliyot"></a>
|
|
457
599
|
|
|
458
600
|
## TriennialAliyot : <code>Object</code>
|