@hebcal/leyning 4.13.2 → 4.13.3

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.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/leyning v4.13.2 */
1
+ /*! @hebcal/leyning v4.13.3 */
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -331,7 +331,7 @@ const HOLIDAY_IGNORE_MASK = core.flags.DAF_YOMI | core.flags.OMER_COUNT | core.f
331
331
  */
332
332
 
333
333
  function getLeyningForHoliday(e, il = false) {
334
- if (!e instanceof core.Event) {
334
+ if (typeof e !== 'object' || !(e instanceof core.Event)) {
335
335
  throw new TypeError(`Bad event argument: ${e}`);
336
336
  } else if (e.getFlags() & core.flags.PARSHA_HASHAVUA) {
337
337
  throw new TypeError(`Event should be a holiday: ${e.getDesc()}`);
@@ -340,16 +340,7 @@ function getLeyningForHoliday(e, il = false) {
340
340
  }
341
341
 
342
342
  const key = getLeyningKeyForEvent(e, il);
343
- const leyning = getLeyningForHolidayKey(key);
344
-
345
- if (key === 'Sukkot Shabbat Chol ha-Moed') {
346
- leyning.fullkriyah['M'] = leyning.fullkriyah[`M-day${e.cholHaMoedDay}`];
347
-
348
- for (let day = 1; day <= 5; day++) {
349
- delete leyning.fullkriyah[`M-day${day}`];
350
- }
351
- }
352
-
343
+ const leyning = getLeyningForHolidayKey(key, e.cholHaMoedDay);
353
344
  return leyning;
354
345
  }
355
346
  /**
@@ -424,7 +415,7 @@ function makeHaftaraSummary(haft) {
424
415
 
425
416
 
426
417
  function makeLeyningParts(aliyot) {
427
- const nums = Object.keys(aliyot);
418
+ const nums = Object.keys(aliyot).filter(x => x.length === 1);
428
419
  let start = aliyot[nums[0]];
429
420
  let end = start;
430
421
  const parts = [];
@@ -497,11 +488,12 @@ function calculateHaftaraNumV(haft) {
497
488
  * (untranslated) string used in holiday-readings.json. Returns some
498
489
  * of full kriyah aliyot, special Maftir, special Haftarah
499
490
  * @param {string} key name from `holiday-readings.json` to find
491
+ * @param {number} [cholHaMoedDay]
500
492
  * @return {Leyning} map of aliyot
501
493
  */
502
494
 
503
495
 
504
- function getLeyningForHolidayKey(key) {
496
+ function getLeyningForHolidayKey(key, cholHaMoedDay) {
505
497
  if (typeof key !== 'string') {
506
498
  return undefined;
507
499
  }
@@ -527,8 +519,18 @@ function getLeyningForHolidayKey(key) {
527
519
  const leyning = Object.create(null);
528
520
 
529
521
  if (src.fullkriyah) {
530
- if (typeof src.fullkriyah['1'] === 'object') {
531
- const parts = makeLeyningParts(src.fullkriyah);
522
+ leyning.fullkriyah = clone(src.fullkriyah);
523
+
524
+ if (key === 'Sukkot Shabbat Chol ha-Moed' && cholHaMoedDay) {
525
+ leyning.fullkriyah['M'] = leyning.fullkriyah[`M-day${cholHaMoedDay}`];
526
+
527
+ for (let day = 1; day <= 5; day++) {
528
+ delete leyning.fullkriyah[`M-day${day}`];
529
+ }
530
+ }
531
+
532
+ if (typeof leyning.fullkriyah['1'] === 'object') {
533
+ const parts = makeLeyningParts(leyning.fullkriyah);
532
534
  leyning.summary = makeSummaryFromParts(parts);
533
535
 
534
536
  if (parts.length > 1) {
@@ -536,7 +538,6 @@ function getLeyningForHolidayKey(key) {
536
538
  }
537
539
  }
538
540
 
539
- leyning.fullkriyah = clone(src.fullkriyah);
540
541
  Object.values(leyning.fullkriyah).map(aliyah => calculateNumVerses(aliyah));
541
542
  }
542
543
 
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/leyning v4.13.2 */
1
+ /*! @hebcal/leyning v4.13.3 */
2
2
  import { parshiot, flags, months, Event, HebrewCalendar, HDate } from '@hebcal/core';
3
3
 
4
4
  const Genesis=[0,31,25,24,26,32,22,24,22,29,32,32,20,18,24,21,16,27,33,38,18,34,24,20,67,34,35,46,22,35,43,54,33,20,31,29,43,36,30,23,23,57,38,34,34,28,34,31,22,33,26];const Exodus=[0,22,25,22,31,23,30,29,28,35,29,10,51,22,31,27,36,16,27,25,26,37,30,33,18,40,37,21,43,46,38,18,35,23,35,35,38,29,31,43,38];const Leviticus=[0,17,16,17,35,26,23,38,36,24,20,47,8,59,57,33,34,16,30,37,27,24,33,44,23,55,46,34];const Numbers=[0,54,34,51,49,31,27,89,26,23,36,35,16,33,45,41,35,28,32,22,29,35,41,30,25,19,65,23,31,39,17,54,42,56,29,34,13];const Deuteronomy=[0,46,37,29,49,33,25,26,20,29,22,32,31,19,29,23,22,20,22,21,20,23,29,26,22,19,19,26,69,28,20,30,52,29,12];const Joshua=[0,18,24,17,24,15,27,26,35,27,43,23,24,33,15,63,10,18,28,51,9,45,34,16,33];const Judges=[0,36,23,31,24,31,40,25,35,57,18,40,15,25,20,20,31,13,31,30,48,25];const Ruth=[0,22,23,18,22];const Isaiah=[0,31,22,26,6,30,13,25,23,20,34,16,6,22,32,9,14,14,7,25,6,17,25,18,23,12,21,13,29,24,33,9,20,24,17,10,22,38,22,8,31,29,25,28,28,25,13,15,22,26,11,23,15,12,17,13,12,21,14,21,22,11,12,19,11,25,24];const Jeremiah=[0,19,37,25,31,31,30,34,23,25,25,23,17,27,22,21,21,27,23,15,18,14,30,40,10,38,24,22,17,32,24,40,44,26,22,19,32,21,28,18,16,18,22,13,30,5,28,7,47,39,46,64,34];const Lamentations=[0,22,22,66,22,22];const Baruch=[0,22,35,38,37,9,72];const Ezekiel=[0,28,10,27,17,17,14,27,18,11,22,25,28,23,23,8,63,24,32,14,44,37,31,49,27,17,21,36,26,21,26,18,32,33,31,15,38,28,23,29,49,26,20,27,31,25,24,23,35];const Daniel=[0,21,49,100,34,30,29,28,27,27,21,45,13,64,42];const Hosea=[0,9,25,5,19,15,11,16,14,17,15,11,15,15,10];const Joel=[0,20,27,5,21];const Amos=[0,15,16,15,13,27,14,17,14,15];const Obadiah=[0,21];const Jonah=[0,16,11,10,11];const Micah=[0,16,13,12,14,14,16,20];const Nahum=[0,14,14,19];const Habakkuk=[0,17,20,19];const Zephaniah=[0,18,15,20];const Haggai=[0,15,23];const Zechariah=[0,17,17,10,14,11,15,14,23,17,12,17,14,9,21];const Malachi=[0,14,17,24];var numverses = {Genesis:Genesis,Exodus:Exodus,Leviticus:Leviticus,Numbers:Numbers,Deuteronomy:Deuteronomy,Joshua:Joshua,Judges:Judges,Ruth:Ruth,"I Samuel":[0,28,36,21,22,12,21,17,22,27,27,15,25,23,52,35,23,58,30,24,42,16,23,28,23,43,25,12,25,11,31,13],"II Samuel":[0,27,32,39,12,25,23,29,18,13,19,27,31,39,33,37,23,29,32,44,26,22,51,39,25],"I Kings":[0,53,46,28,20,32,38,51,66,28,29,43,33,34,31,34,34,24,46,21,43,29,54],"II Kings":[0,18,25,27,44,27,33,20,29,37,36,20,22,25,29,38,20,41,37,37,21,26,20,37,20,30],Isaiah:Isaiah,Jeremiah:Jeremiah,Lamentations:Lamentations,Baruch:Baruch,Ezekiel:Ezekiel,Daniel:Daniel,Hosea:Hosea,Joel:Joel,Amos:Amos,Obadiah:Obadiah,Jonah:Jonah,Micah:Micah,Nahum:Nahum,Habakkuk:Habakkuk,Zephaniah:Zephaniah,Haggai:Haggai,Zechariah:Zechariah,Malachi:Malachi};
@@ -327,7 +327,7 @@ const HOLIDAY_IGNORE_MASK = flags.DAF_YOMI | flags.OMER_COUNT | flags.SHABBAT_ME
327
327
  */
328
328
 
329
329
  function getLeyningForHoliday(e, il = false) {
330
- if (!e instanceof Event) {
330
+ if (typeof e !== 'object' || !(e instanceof Event)) {
331
331
  throw new TypeError(`Bad event argument: ${e}`);
332
332
  } else if (e.getFlags() & flags.PARSHA_HASHAVUA) {
333
333
  throw new TypeError(`Event should be a holiday: ${e.getDesc()}`);
@@ -336,16 +336,7 @@ function getLeyningForHoliday(e, il = false) {
336
336
  }
337
337
 
338
338
  const key = getLeyningKeyForEvent(e, il);
339
- const leyning = getLeyningForHolidayKey(key);
340
-
341
- if (key === 'Sukkot Shabbat Chol ha-Moed') {
342
- leyning.fullkriyah['M'] = leyning.fullkriyah[`M-day${e.cholHaMoedDay}`];
343
-
344
- for (let day = 1; day <= 5; day++) {
345
- delete leyning.fullkriyah[`M-day${day}`];
346
- }
347
- }
348
-
339
+ const leyning = getLeyningForHolidayKey(key, e.cholHaMoedDay);
349
340
  return leyning;
350
341
  }
351
342
  /**
@@ -420,7 +411,7 @@ function makeHaftaraSummary(haft) {
420
411
 
421
412
 
422
413
  function makeLeyningParts(aliyot) {
423
- const nums = Object.keys(aliyot);
414
+ const nums = Object.keys(aliyot).filter(x => x.length === 1);
424
415
  let start = aliyot[nums[0]];
425
416
  let end = start;
426
417
  const parts = [];
@@ -493,11 +484,12 @@ function calculateHaftaraNumV(haft) {
493
484
  * (untranslated) string used in holiday-readings.json. Returns some
494
485
  * of full kriyah aliyot, special Maftir, special Haftarah
495
486
  * @param {string} key name from `holiday-readings.json` to find
487
+ * @param {number} [cholHaMoedDay]
496
488
  * @return {Leyning} map of aliyot
497
489
  */
498
490
 
499
491
 
500
- function getLeyningForHolidayKey(key) {
492
+ function getLeyningForHolidayKey(key, cholHaMoedDay) {
501
493
  if (typeof key !== 'string') {
502
494
  return undefined;
503
495
  }
@@ -523,8 +515,18 @@ function getLeyningForHolidayKey(key) {
523
515
  const leyning = Object.create(null);
524
516
 
525
517
  if (src.fullkriyah) {
526
- if (typeof src.fullkriyah['1'] === 'object') {
527
- const parts = makeLeyningParts(src.fullkriyah);
518
+ leyning.fullkriyah = clone(src.fullkriyah);
519
+
520
+ if (key === 'Sukkot Shabbat Chol ha-Moed' && cholHaMoedDay) {
521
+ leyning.fullkriyah['M'] = leyning.fullkriyah[`M-day${cholHaMoedDay}`];
522
+
523
+ for (let day = 1; day <= 5; day++) {
524
+ delete leyning.fullkriyah[`M-day${day}`];
525
+ }
526
+ }
527
+
528
+ if (typeof leyning.fullkriyah['1'] === 'object') {
529
+ const parts = makeLeyningParts(leyning.fullkriyah);
528
530
  leyning.summary = makeSummaryFromParts(parts);
529
531
 
530
532
  if (parts.length > 1) {
@@ -532,7 +534,6 @@ function getLeyningForHolidayKey(key) {
532
534
  }
533
535
  }
534
536
 
535
- leyning.fullkriyah = clone(src.fullkriyah);
536
537
  Object.values(leyning.fullkriyah).map(aliyah => calculateNumVerses(aliyah));
537
538
  }
538
539
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/leyning",
3
- "version": "4.13.2",
3
+ "version": "4.13.3",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "keywords": [
6
6
  "hebcal",
@@ -31,7 +31,7 @@
31
31
  "leyning-csv": "bin/leyning-csv"
32
32
  },
33
33
  "dependencies": {
34
- "@hebcal/core": "^3.33.5"
34
+ "@hebcal/core": "^3.36.2"
35
35
  },
36
36
  "scripts": {
37
37
  "build": "rollup -c",
@@ -52,20 +52,20 @@
52
52
  "verbose": true
53
53
  },
54
54
  "devDependencies": {
55
- "@babel/core": "^7.17.8",
55
+ "@babel/core": "^7.17.9",
56
56
  "@babel/preset-env": "^7.16.11",
57
57
  "@babel/register": "^7.17.7",
58
58
  "@rollup/plugin-babel": "^5.3.1",
59
- "@rollup/plugin-commonjs": "^21.0.2",
59
+ "@rollup/plugin-commonjs": "^22.0.0",
60
60
  "@rollup/plugin-json": "^4.1.0",
61
- "@rollup/plugin-node-resolve": "^13.1.3",
62
- "ava": "^4.1.0",
63
- "core-js": "^3.21.1",
64
- "eslint": "^8.11.0",
61
+ "@rollup/plugin-node-resolve": "^13.2.1",
62
+ "ava": "^4.2.0",
63
+ "core-js": "^3.22.2",
64
+ "eslint": "^8.14.0",
65
65
  "eslint-config-google": "^0.14.0",
66
66
  "jsdoc": "^3.6.10",
67
67
  "jsdoc-to-markdown": "^7.1.1",
68
- "rollup": "^2.70.1",
68
+ "rollup": "^2.70.2",
69
69
  "rollup-plugin-terser": "^7.0.2"
70
70
  }
71
71
  }