@hebcal/core 5.0.3 → 5.0.4

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
@@ -3122,13 +3122,6 @@ Tachanun is not said at Shacharit on Shabbat, but is at Mincha, usually.
3122
3122
  Gregorian date helper functions.
3123
3123
 
3124
3124
  **Kind**: global variable
3125
- <a name="greg.monthNames"></a>
3126
-
3127
- ### greg.monthNames : <code>Array.&lt;string&gt;</code>
3128
- Long names of the Gregorian months (1='January', 12='December')
3129
-
3130
- **Kind**: static property of [<code>greg</code>](#greg)
3131
- **Read only**: true
3132
3125
  <a name="months"></a>
3133
3126
 
3134
3127
  ## months : <code>enum</code>
package/dist/bundle.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v5.0.3 */
1
+ /*! @hebcal/core v5.0.4 */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -28,12 +28,6 @@ const ABS_2SEP1752 = 639785;
28
28
  */
29
29
  exports.greg = void 0;
30
30
  (function (greg) {
31
- /**
32
- * Long names of the Gregorian months (1='January', 12='December')
33
- * @readonly
34
- * @type {string[]}
35
- */
36
- greg.monthNames = ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
37
31
  /**
38
32
  * Returns true if the Gregorian year is a leap year
39
33
  * @param {number} year Gregorian year
@@ -7772,7 +7766,6 @@ class Sedra {
7772
7766
  }
7773
7767
 
7774
7768
  /**
7775
- * @private
7776
7769
  * @return {Object[]}
7777
7770
  */
7778
7771
  getSedraArray() {
@@ -7805,7 +7798,7 @@ class Sedra {
7805
7798
  const weekNum = (saturday - this.firstSaturday) / 7;
7806
7799
  const index = this.theSedraArray[weekNum];
7807
7800
  if (typeof index === 'undefined') {
7808
- const sedra = new Sedra(this.year + 1, this.il);
7801
+ const sedra = getSedra_(this.year + 1, this.il);
7809
7802
  return sedra.lookup(saturday); // must be next year
7810
7803
  }
7811
7804
  if (typeof index === 'string') {
@@ -7995,6 +7988,23 @@ types['1311'] = types['1221'];
7995
7988
  /* Hebrew year that starts on Saturday, is `complete' (Heshvan and
7996
7989
  * Kislev each have 30 days), and has Passover start on Thursday. */
7997
7990
  types['1721'] = types['170'];
7991
+ const sedraCache = new Map();
7992
+
7993
+ /**
7994
+ * @private
7995
+ * @param {number} hyear
7996
+ * @param {boolean} il
7997
+ * @return {Sedra}
7998
+ */
7999
+ function getSedra_(hyear, il) {
8000
+ const cacheKey = `${hyear}-${il ? 1 : 0}`;
8001
+ let sedra = sedraCache.get(cacheKey);
8002
+ if (!sedra) {
8003
+ sedra = new Sedra(hyear, il);
8004
+ sedraCache.set(cacheKey, sedra);
8005
+ }
8006
+ return sedra;
8007
+ }
7998
8008
 
7999
8009
  /**
8000
8010
  * Represents one of 54 weekly Torah portions, always on a Saturday
@@ -9489,23 +9499,6 @@ const KISLEV = months.KISLEV;
9489
9499
  const TEVET = months.TEVET;
9490
9500
  const ADAR_I = months.ADAR_I;
9491
9501
  const ADAR_II = months.ADAR_II;
9492
- const sedraCache = new Map();
9493
-
9494
- /**
9495
- * @private
9496
- * @param {number} hyear
9497
- * @param {boolean} il
9498
- * @return {Sedra}
9499
- */
9500
- function getSedra_(hyear, il) {
9501
- const cacheKey = `${hyear}-${il ? 1 : 0}`;
9502
- let sedra = sedraCache.get(cacheKey);
9503
- if (!sedra) {
9504
- sedra = new Sedra(hyear, il);
9505
- sedraCache.set(cacheKey, sedra);
9506
- }
9507
- return sedra;
9508
- }
9509
9502
  const emojiIsraelFlag = {
9510
9503
  emoji: '🇮🇱'
9511
9504
  };
@@ -9769,7 +9762,7 @@ class DailyLearning {
9769
9762
  }
9770
9763
 
9771
9764
  // DO NOT EDIT THIS AUTO-GENERATED FILE!
9772
- const version = '5.0.3';
9765
+ const version = '5.0.4';
9773
9766
 
9774
9767
  var objectGetOwnPropertyDescriptor = {};
9775
9768
 
@@ -11307,8 +11300,6 @@ function observedInIsrael(ev) {
11307
11300
  function observedInDiaspora(ev) {
11308
11301
  return ev.observedInDiaspora();
11309
11302
  }
11310
- const yearArrayCache = new Map();
11311
- const holidaysOnDate = new Map();
11312
11303
 
11313
11304
  /**
11314
11305
  * HebrewCalendar is the main interface to the `@hebcal/core` library.
@@ -11634,15 +11625,10 @@ class HebrewCalendar {
11634
11625
  * @return {Event[]}
11635
11626
  */
11636
11627
  static getHolidaysForYearArray(year, il) {
11637
- const cacheKey = `${year}-${il ? 1 : 0}`;
11638
- let events = yearArrayCache.get(cacheKey);
11639
- if (events) {
11640
- return events;
11641
- }
11642
11628
  const yearMap = getHolidaysForYear_(year);
11643
11629
  const startAbs = HDate.hebrew2abs(year, TISHREI, 1);
11644
11630
  const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
11645
- events = [];
11631
+ let events = [];
11646
11632
  const myFilter = il ? observedInIsrael : observedInDiaspora;
11647
11633
  for (let absDt = startAbs; absDt <= endAbs; absDt++) {
11648
11634
  const hd = new HDate(absDt);
@@ -11652,7 +11638,6 @@ class HebrewCalendar {
11652
11638
  events = events.concat(filtered);
11653
11639
  }
11654
11640
  }
11655
- yearArrayCache.set(cacheKey, events);
11656
11641
  return events;
11657
11642
  }
11658
11643
 
@@ -11665,20 +11650,14 @@ class HebrewCalendar {
11665
11650
  static getHolidaysOnDate(date, il) {
11666
11651
  const hd = HDate.isHDate(date) ? date : new HDate(date);
11667
11652
  const hdStr = hd.toString();
11668
- const cacheKey = hdStr + '/' + (typeof il === 'undefined' ? 2 : il ? 1 : 0);
11669
- if (holidaysOnDate.has(cacheKey)) {
11670
- return holidaysOnDate.get(cacheKey);
11671
- }
11672
11653
  const yearMap = getHolidaysForYear_(hd.getFullYear());
11673
11654
  const events = yearMap.get(hdStr);
11674
11655
  // if il isn't a boolean return both diaspora + IL for day
11675
11656
  if (typeof il === 'undefined' || typeof events === 'undefined') {
11676
- holidaysOnDate.set(cacheKey, events);
11677
11657
  return events;
11678
11658
  }
11679
11659
  const myFilter = il ? observedInIsrael : observedInDiaspora;
11680
11660
  const filtered = events.filter(myFilter);
11681
- holidaysOnDate.set(cacheKey, filtered);
11682
11661
  return filtered;
11683
11662
  }
11684
11663