@hebcal/core 5.4.9 → 5.4.10

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/bundle.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v5.4.9 */
1
+ /*! @hebcal/core v5.4.10 */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -10461,7 +10461,7 @@ class Sedra {
10461
10461
  */
10462
10462
  find(parsha) {
10463
10463
  if (typeof parsha === 'number') {
10464
- if (parsha > 53 || (parsha < 0 && !isValidDouble(parsha))) {
10464
+ if (parsha >= parshiot.length || (parsha < 0 && !isValidDouble(parsha))) {
10465
10465
  throw new RangeError(`Invalid parsha number: ${parsha}`);
10466
10466
  }
10467
10467
  const idx = this.theSedraArray.indexOf(parsha);
@@ -10487,29 +10487,27 @@ class Sedra {
10487
10487
  return new HDate(this.firstSaturday + idx * 7);
10488
10488
  }
10489
10489
  }
10490
- else if (Array.isArray(parsha) &&
10491
- parsha.length === 1 &&
10492
- typeof parsha[0] === 'string') {
10493
- return this.find(parsha[0]);
10494
- }
10495
- else if (Array.isArray(parsha) &&
10496
- parsha.length === 2 &&
10497
- typeof parsha[0] === 'string' &&
10498
- typeof parsha[1] === 'string') {
10490
+ else if (Array.isArray(parsha)) {
10491
+ const plen = parsha.length;
10492
+ if ((plen !== 1 && plen !== 2) || typeof parsha[0] !== 'string') {
10493
+ throw new TypeError(`Invalid parsha argument: ${JSON.stringify(parsha)}`);
10494
+ }
10495
+ if (plen === 1) {
10496
+ return this.find(parsha[0]);
10497
+ }
10499
10498
  const p1 = parsha[0];
10500
10499
  const p2 = parsha[1];
10501
10500
  const num1 = parsha2id.get(p1);
10502
10501
  const num2 = parsha2id.get(p2);
10503
- if (num2 === num1 + 1) {
10504
- return this.find(-num1);
10505
- }
10506
- else {
10502
+ if (typeof num1 !== 'number' ||
10503
+ typeof num2 !== 'number' ||
10504
+ num2 !== num1 + 1 ||
10505
+ !isValidDouble(-num1)) {
10507
10506
  throw new RangeError(`Unrecognized parsha name: ${p1}-${p2}`);
10508
10507
  }
10508
+ return this.find(-num1);
10509
10509
  }
10510
- else {
10511
- throw new TypeError(`Invalid parsha argument: ${parsha}`);
10512
- }
10510
+ return null; /* NOTREACHED */
10513
10511
  }
10514
10512
  /**
10515
10513
  * Returns the underlying annual sedra schedule.
@@ -11458,17 +11456,6 @@ const staticModernHolidays = [
11458
11456
  },
11459
11457
  ];
11460
11458
 
11461
- const minorHolidays = [
11462
- holidayDesc.LAG_BAOMER,
11463
- holidayDesc.LEIL_SELICHOT,
11464
- holidayDesc.PESACH_SHENI,
11465
- holidayDesc.EREV_PURIM,
11466
- holidayDesc.PURIM_KATAN,
11467
- holidayDesc.SHUSHAN_PURIM,
11468
- holidayDesc.TU_BAV,
11469
- holidayDesc.TU_BISHVAT,
11470
- holidayDesc.ROSH_HASHANA_LABEHEMOT,
11471
- ];
11472
11459
  /** Represents a built-in holiday like Pesach, Purim or Tu BiShvat */
11473
11460
  class HolidayEvent extends Event {
11474
11461
  basename() {
@@ -11518,8 +11505,17 @@ class HolidayEvent extends Event {
11518
11505
  }
11519
11506
  // Don't depend on flags.MINOR_HOLIDAY always being set. Look for minor holidays.
11520
11507
  const desc = this.getDesc();
11521
- if (minorHolidays.includes(desc)) {
11522
- return ['holiday', 'minor'];
11508
+ switch (desc) {
11509
+ case holidayDesc.LAG_BAOMER:
11510
+ case holidayDesc.LEIL_SELICHOT:
11511
+ case holidayDesc.PESACH_SHENI:
11512
+ case holidayDesc.EREV_PURIM:
11513
+ case holidayDesc.PURIM_KATAN:
11514
+ case holidayDesc.SHUSHAN_PURIM:
11515
+ case holidayDesc.TU_BAV:
11516
+ case holidayDesc.TU_BISHVAT:
11517
+ case holidayDesc.ROSH_HASHANA_LABEHEMOT:
11518
+ return ['holiday', 'minor'];
11523
11519
  }
11524
11520
  return ['holiday', 'major'];
11525
11521
  }
@@ -11697,7 +11693,7 @@ class DailyLearning {
11697
11693
  }
11698
11694
 
11699
11695
  /** DO NOT EDIT THIS AUTO-GENERATED FILE! */
11700
- const version = '5.4.9';
11696
+ const version = '5.4.10';
11701
11697
 
11702
11698
  /* eslint-disable max-len */
11703
11699
  /**
@@ -12742,6 +12738,7 @@ function observedInDiaspora(ev) {
12742
12738
  * Event names can be rendered in several languges using the `locale` option.
12743
12739
  */
12744
12740
  class HebrewCalendar {
12741
+ constructor() { }
12745
12742
  /**
12746
12743
  * Calculates holidays and other Hebrew calendar events based on {@link CalOptions}.
12747
12744
  *