@hebcal/leyning 5.1.0 → 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 CHANGED
@@ -77,12 +77,40 @@ for (const [num, aliyah] of Object.entries(triReading)) {
77
77
  ## Functions
78
78
 
79
79
  <dl>
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>
90
+ </dd>
80
91
  <dt><a href="#formatAliyahWithBook">formatAliyahWithBook(a)</a> ⇒ <code>string</code></dt>
81
92
  <dd><p>Formats an aliyah object like &quot;Numbers 28:9-28:15&quot;</p>
82
93
  </dd>
83
94
  <dt><a href="#formatAliyahShort">formatAliyahShort(aliyah, showBook)</a> ⇒ <code>string</code></dt>
84
95
  <dd><p>Formats an aliyah object like &quot;Numbers 28:9-15&quot;</p>
85
96
  </dd>
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>
99
+ </dd>
100
+ <dt><a href="#makeLeyningParts">makeLeyningParts(aliyot)</a> ⇒ <code><a href="#Aliyah">Array.&lt;Aliyah&gt;</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>
110
+ </dd>
111
+ <dt><a href="#makeLeyningSummary">makeLeyningSummary(aliyot)</a> ⇒ <code>string</code></dt>
112
+ <dd><p>Makes a summary of the leyning, like &quot;Genesis 6:9-11:32&quot;</p>
113
+ </dd>
86
114
  <dt><a href="#hasFestival">hasFestival(holiday)</a> ⇒ <code>boolean</code></dt>
87
115
  <dd><p>Is there a special festival Torah Reading for <code>holiday</code>?</p>
88
116
  </dd>
@@ -96,9 +124,6 @@ for (const [num, aliyah] of Object.entries(triReading)) {
96
124
  <dd><p>Looks up leyning for a given holiday. Returns some
97
125
  of full kriyah aliyot, special Maftir, special Haftarah</p>
98
126
  </dd>
99
- <dt><a href="#makeLeyningSummary">makeLeyningSummary(aliyot)</a> ⇒ <code>string</code></dt>
100
- <dd><p>Makes a summary of the leyning, like &quot;Genesis 6:9-11:32&quot;</p>
101
- </dd>
102
127
  <dt><a href="#getLeyningForHolidayKey">getLeyningForHolidayKey(key, [cholHaMoedDay])</a> ⇒ <code><a href="#Leyning">Leyning</a></code></dt>
103
128
  <dd><p>Looks up leyning for a given holiday key. Key should be an
104
129
  (untranslated) string used in holiday-readings.json. Returns some
@@ -229,6 +254,41 @@ Names of the books of the Torah. BOOK[1] === 'Genesis'
229
254
 
230
255
  **Kind**: global constant
231
256
  **Read only**: true
257
+ <a name="parshaToString"></a>
258
+
259
+ ## parshaToString(parsha) ⇒ <code>string</code>
260
+ Formats parsha as a string
261
+
262
+ **Kind**: global function
263
+
264
+ | Param | Type |
265
+ | --- | --- |
266
+ | parsha | <code>Array.&lt;string&gt;</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
272
+
273
+ **Kind**: global function
274
+
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) |
291
+
232
292
  <a name="formatAliyahWithBook"></a>
233
293
 
234
294
  ## formatAliyahWithBook(a) ⇒ <code>string</code>
@@ -252,6 +312,55 @@ Formats an aliyah object like "Numbers 28:9-15"
252
312
  | aliyah | [<code>Aliyah</code>](#Aliyah) |
253
313
  | showBook | <code>boolean</code> |
254
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.&lt;Aliyah&gt;</code>](#Aliyah) |
325
+
326
+ <a name="makeLeyningParts"></a>
327
+
328
+ ## makeLeyningParts(aliyot) ⇒ [<code>Array.&lt;Aliyah&gt;</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.&lt;string, Aliyah&gt;</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.&lt;Aliyah&gt;</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.&lt;string, Aliyah&gt;</code> |
363
+
255
364
  <a name="hasFestival"></a>
256
365
 
257
366
  ## hasFestival(holiday) ⇒ <code>boolean</code>
@@ -301,17 +410,6 @@ of full kriyah aliyot, special Maftir, special Haftarah
301
410
  | ev | <code>Event</code> | | the Hebcal event associated with this leyning |
302
411
  | [il] | <code>boolean</code> | <code>false</code> | true if Israel holiday scheme |
303
412
 
304
- <a name="makeLeyningSummary"></a>
305
-
306
- ## makeLeyningSummary(aliyot) ⇒ <code>string</code>
307
- Makes a summary of the leyning, like "Genesis 6:9-11:32"
308
-
309
- **Kind**: global function
310
-
311
- | Param | Type |
312
- | --- | --- |
313
- | aliyot | <code>Object.&lt;string, Aliyah&gt;</code> |
314
-
315
413
  <a name="getLeyningForHolidayKey"></a>
316
414
 
317
415
  ## getLeyningForHolidayKey(key, [cholHaMoedDay]) ⇒ [<code>Leyning</code>](#Leyning)