@hebcal/core 5.0.0-rc6 → 5.0.1

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/core v5.0.0-rc6 */
1
+ /*! @hebcal/core v5.0.1 */
2
2
  'use strict';
3
3
 
4
4
  const GERESH = '׳';
@@ -28,10 +28,9 @@ const heb2num = {
28
28
  'ת': 400
29
29
  };
30
30
  const num2heb = new Map();
31
- Object.keys(heb2num).forEach(key => {
32
- const val = heb2num[key];
31
+ for (const [key, val] of Object.entries(heb2num)) {
33
32
  num2heb.set(val, key);
34
- });
33
+ }
35
34
 
36
35
  /**
37
36
  * @private
@@ -251,9 +250,7 @@ class Locale {
251
250
  throw new TypeError(`Locale '${locale}' invalid compact format`);
252
251
  }
253
252
  const ctx = data.contexts[''];
254
- Object.keys(ctx).forEach(id => {
255
- loc[id] = ctx[id];
256
- });
253
+ Object.assign(loc, ctx);
257
254
  }
258
255
  /**
259
256
  * Activates a locale. Throws an error if the locale has not been previously added.
@@ -1156,7 +1153,7 @@ class HDate {
1156
1153
  * @private
1157
1154
  * @type {number}
1158
1155
  */
1159
- this.abs0 = abs0;
1156
+ this.rd = abs0;
1160
1157
  }
1161
1158
  }
1162
1159
  }
@@ -1257,10 +1254,10 @@ class HDate {
1257
1254
  * @return {number}
1258
1255
  */
1259
1256
  abs() {
1260
- if (typeof this.abs0 !== 'number') {
1261
- this.abs0 = hebrew2abs(this.yy, this.mm, this.dd);
1257
+ if (typeof this.rd !== 'number') {
1258
+ this.rd = hebrew2abs(this.yy, this.mm, this.dd);
1262
1259
  }
1263
- return this.abs0;
1260
+ return this.rd;
1264
1261
  }
1265
1262
 
1266
1263
  /**
@@ -1746,7 +1743,7 @@ function fixMonth(date) {
1746
1743
  date.yy += 1;
1747
1744
  fix(date);
1748
1745
  }
1749
- delete date.abs0;
1746
+ delete date.rd;
1750
1747
  }
1751
1748
 
1752
1749
  /**
@@ -1837,7 +1834,7 @@ class Event {
1837
1834
  this.desc = desc;
1838
1835
  this.mask = +mask;
1839
1836
  if (typeof attrs === 'object' && attrs !== null) {
1840
- Object.keys(attrs).forEach(k => this[k] = attrs[k]);
1837
+ Object.assign(this, attrs);
1841
1838
  }
1842
1839
  }
1843
1840
  /**
@@ -3430,10 +3427,10 @@ class Location extends GeoLocation {
3430
3427
  return true;
3431
3428
  }
3432
3429
  }
3433
- classicCities0.forEach(city => {
3430
+ for (const city of classicCities0) {
3434
3431
  const location = new Location(city[2], city[3], city[1] == 'IL', city[4], city[0], city[1], undefined, city[5]);
3435
3432
  Location.addLocation(location.getName(), location);
3436
- });
3433
+ }
3437
3434
 
3438
3435
  const _formatters = new Map();
3439
3436
 
@@ -3940,7 +3937,6 @@ function makeCandleEvent(e, hd, dow, location, options) {
3940
3937
  if (isNaN(time.getTime())) {
3941
3938
  return null; // no sunset
3942
3939
  }
3943
-
3944
3940
  if (havdalahTitle) {
3945
3941
  return new HavdalahEvent(hd, mask, time, location, options.havdalahMins, e);
3946
3942
  } else {
@@ -4575,7 +4571,6 @@ class Sedra {
4575
4571
  if (idx === -1) {
4576
4572
  return null; // doesn't occur this year
4577
4573
  }
4578
-
4579
4574
  return new HDate(this.firstSaturday + idx * 7);
4580
4575
  } else if (typeof parsha === 'string') {
4581
4576
  const num = parsha2id.get(parsha);
@@ -4589,7 +4584,6 @@ class Sedra {
4589
4584
  if (idx === -1) {
4590
4585
  return null; // doesn't occur this year
4591
4586
  }
4592
-
4593
4587
  return new HDate(this.firstSaturday + idx * 7);
4594
4588
  }
4595
4589
  } else if (Array.isArray(parsha) && parsha.length === 1 && typeof parsha[0] === 'string') {
@@ -4646,7 +4640,6 @@ class Sedra {
4646
4640
  const sedra = new Sedra(this.year + 1, this.il);
4647
4641
  return sedra.lookup(saturday); // must be next year
4648
4642
  }
4649
-
4650
4643
  if (typeof index === 'string') {
4651
4644
  // Shabbat has a chag. Return a description
4652
4645
  return {
@@ -5616,40 +5609,7 @@ const MINOR_HOLIDAY$1 = flags.MINOR_HOLIDAY;
5616
5609
  const EREV$1 = flags.EREV;
5617
5610
  // const CHOL_HAMOED = flags.CHOL_HAMOED;
5618
5611
 
5619
- /**
5620
- * Avoid dependency on ES6 Map object
5621
- * @private
5622
- */
5623
- class SimpleMap {
5624
- /**
5625
- * @param {string} key
5626
- * @return {boolean}
5627
- */
5628
- has(key) {
5629
- return typeof this[key] !== 'undefined';
5630
- }
5631
- /**
5632
- * @param {string} key
5633
- * @return {any}
5634
- */
5635
- get(key) {
5636
- return this[key];
5637
- }
5638
- /**
5639
- * @param {string} key
5640
- * @param {any} val
5641
- */
5642
- set(key, val) {
5643
- this[key] = val;
5644
- }
5645
- /**
5646
- * @return {string[]}
5647
- */
5648
- keys() {
5649
- return Object.keys(this);
5650
- }
5651
- }
5652
- const sedraCache = new SimpleMap();
5612
+ const sedraCache = new Map();
5653
5613
 
5654
5614
  /**
5655
5615
  * @private
@@ -5693,13 +5653,12 @@ function getHolidaysForYear_(year) {
5693
5653
  }
5694
5654
  const RH = new HDate(1, TISHREI$1, year);
5695
5655
  const pesach = new HDate(15, NISAN$1, year);
5696
- const h = new SimpleMap();
5656
+ const map = new Map();
5697
5657
  // eslint-disable-next-line require-jsdoc
5698
5658
  function add(...events) {
5699
- // for (const ev of events) {
5700
- events.forEach(ev => {
5659
+ for (const ev of events) {
5701
5660
  const key = ev.date.toString();
5702
- const arr = h.get(key);
5661
+ const arr = map.get(key);
5703
5662
  if (typeof arr === 'object') {
5704
5663
  if (arr[0].getFlags() & flags.EREV) {
5705
5664
  arr.unshift(ev);
@@ -5707,17 +5666,17 @@ function getHolidaysForYear_(year) {
5707
5666
  arr.push(ev);
5708
5667
  }
5709
5668
  } else {
5710
- h.set(key, [ev]);
5669
+ map.set(key, [ev]);
5711
5670
  }
5712
- });
5671
+ }
5713
5672
  }
5714
- staticHolidays.forEach(h => {
5673
+ for (const h of staticHolidays) {
5715
5674
  const hd = new HDate(h.dd, h.mm, year);
5716
5675
  const ev = new HolidayEvent(hd, h.desc, h.flags);
5717
5676
  if (h.emoji) ev.emoji = h.emoji;
5718
5677
  if (h.chmDay) ev.cholHaMoedDay = h.chmDay;
5719
5678
  add(ev);
5720
- });
5679
+ }
5721
5680
 
5722
5681
  // standard holidays that don't shift based on year
5723
5682
  add(new RoshHashanaEvent(RH, year, CHAG | LIGHT_CANDLES_TZEIS$1));
@@ -5769,7 +5728,7 @@ function getHolidaysForYear_(year) {
5769
5728
  if (yomHaZikaronDt) {
5770
5729
  add(new HolidayEvent(yomHaZikaronDt, 'Yom HaZikaron', MODERN_HOLIDAY$1, emojiIsraelFlag), new HolidayEvent(yomHaZikaronDt.next(), 'Yom HaAtzma\'ut', MODERN_HOLIDAY$1, emojiIsraelFlag));
5771
5730
  }
5772
- staticModernHolidays.forEach(h => {
5731
+ for (const h of staticModernHolidays) {
5773
5732
  if (year >= h.firstYear) {
5774
5733
  let hd = new HDate(h.dd, h.mm, year);
5775
5734
  const dow = hd.getDay();
@@ -5787,7 +5746,7 @@ function getHolidaysForYear_(year) {
5787
5746
  }
5788
5747
  add(ev);
5789
5748
  }
5790
- });
5749
+ }
5791
5750
  let tamuz17 = new HDate(17, TAMUZ, year);
5792
5751
  let tamuz17attrs;
5793
5752
  if (tamuz17.getDay() == SAT$1) {
@@ -5858,8 +5817,8 @@ function getHolidaysForYear_(year) {
5858
5817
  emoji: '☀️'
5859
5818
  }));
5860
5819
  }
5861
- yearCache.set(year, h);
5862
- return h;
5820
+ yearCache.set(year, map);
5821
+ return map;
5863
5822
  }
5864
5823
 
5865
5824
  /**
@@ -5926,7 +5885,7 @@ class DailyLearning {
5926
5885
  }
5927
5886
  }
5928
5887
 
5929
- const version="5.0.0-rc6";
5888
+ const version="5.0.1";
5930
5889
 
5931
5890
  const headers$1={"plural-forms":"nplurals=2; plural=(n > 1);"};const contexts$1={"":{Shabbat:["Shabbos"],"Achrei Mot":["Achrei Mos"],Bechukotai:["Bechukosai"],"Beha'alotcha":["Beha'aloscha"],Bereshit:["Bereshis"],Chukat:["Chukas"],"Erev Shavuot":["Erev Shavuos"],"Erev Sukkot":["Erev Sukkos"],"Ki Tavo":["Ki Savo"],"Ki Teitzei":["Ki Seitzei"],"Ki Tisa":["Ki Sisa"],Matot:["Matos"],"Purim Katan":["Purim Koton"],"Shabbat Chazon":["Shabbos Chazon"],"Shabbat HaChodesh":["Shabbos HaChodesh"],"Shabbat HaGadol":["Shabbos HaGadol"],"Shabbat Nachamu":["Shabbos Nachamu"],"Shabbat Parah":["Shabbos Parah"],"Shabbat Shekalim":["Shabbos Shekalim"],"Shabbat Shuva":["Shabbos Shuvah"],"Shabbat Zachor":["Shabbos Zachor"],Shavuot:["Shavuos"],"Shavuot I":["Shavuos I"],"Shavuot II":["Shavuos II"],Shemot:["Shemos"],"Shmini Atzeret":["Shmini Atzeres"],"Simchat Torah":["Simchas Torah"],Sukkot:["Sukkos"],"Sukkot I":["Sukkos I"],"Sukkot II":["Sukkos II"],"Sukkot II (CH''M)":["Sukkos II (CH''M)"],"Sukkot III (CH''M)":["Sukkos III (CH''M)"],"Sukkot IV (CH''M)":["Sukkos IV (CH''M)"],"Sukkot V (CH''M)":["Sukkos V (CH''M)"],"Sukkot VI (CH''M)":["Sukkos VI (CH''M)"],"Sukkot VII (Hoshana Raba)":["Sukkos VII (Hoshana Raba)"],"Ta'anit Bechorot":["Ta'anis Bechoros"],"Ta'anit Esther":["Ta'anis Esther"],Toldot:["Toldos"],Vaetchanan:["Vaeschanan"],Yitro:["Yisro"],"Vezot Haberakhah":["Vezos Haberakhah"],Parashat:["Parshas"],"Leil Selichot":["Leil Selichos"],"Shabbat Mevarchim Chodesh":["Shabbos Mevorchim Chodesh"],"Shabbat Shirah":["Shabbos Shirah"],Tevet:["Teves"],"Asara B'Tevet":["Asara B'Teves"],"Alot HaShachar":["Alos HaShachar"],"Kriat Shema, sof zeman":["Krias Shema, sof zman"],"Tefilah, sof zeman":["Tefilah, sof zman"],"Kriat Shema, sof zeman (MGA)":["Krias Shema, sof zman (MGA)"],"Tefilah, sof zeman (MGA)":["Tefilah, sof zman (MGA)"],"Chatzot HaLailah":["Chatzos HaLailah"],"Chatzot hayom":["Chatzos"],"Tzeit HaKochavim":["Tzeis HaKochavim"],"Birkat Hachamah":["Birkas Hachamah"],"Shushan Purim Katan":["Shushan Purim Koton"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
5932
5891
 
@@ -5939,9 +5898,9 @@ Locale.addLocale('he', poHe);
5939
5898
  Locale.addLocale('h', poHe);
5940
5899
  const heStrs = poHe.contexts[''];
5941
5900
  const heNoNikud = {};
5942
- Object.keys(heStrs).forEach(key => {
5943
- heNoNikud[key] = [Locale.hebrewStripNikkud(heStrs[key][0])];
5944
- });
5901
+ for (const [key, val] of Object.entries(heStrs)) {
5902
+ heNoNikud[key] = [Locale.hebrewStripNikkud(val[0])];
5903
+ }
5945
5904
  const poHeNoNikud = {
5946
5905
  headers: poHe.headers,
5947
5906
  contexts: {
@@ -6106,7 +6065,6 @@ function tachanunYear(year, il) {
6106
6065
  // Purim
6107
6066
  shushPurim, leap ? new HDate(14, months.ADAR_I, year) : [] // Purim Katan
6108
6067
  );
6109
-
6110
6068
  const some = [].concat(
6111
6069
  // Until 14 Sivan
6112
6070
  range(1, 13).map(mday => new HDate(mday, months.SIVAN, year)),
@@ -6123,7 +6081,6 @@ function tachanunYear(year, il) {
6123
6081
  // Erev Yom Kippur
6124
6082
  new HDate(14, months.IYYAR, year) // Pesach Sheini
6125
6083
  );
6126
-
6127
6084
  return {
6128
6085
  none: none.map(hd => hd.abs()).sort((a, b) => a - b),
6129
6086
  some: some.map(hd => hd.abs()).sort((a, b) => a - b),
@@ -6224,24 +6181,12 @@ const RECOGNIZED_OPTIONS = {
6224
6181
  * @param {CalOptions} options
6225
6182
  */
6226
6183
  function warnUnrecognizedOptions(options) {
6227
- Object.keys(options).forEach(k => {
6184
+ for (const k of Object.keys(options)) {
6228
6185
  if (typeof RECOGNIZED_OPTIONS[k] === 'undefined' && !unrecognizedAlreadyWarned.has(k)) {
6229
6186
  console.warn(`Ignoring unrecognized HebrewCalendar option: ${k}`);
6230
6187
  unrecognizedAlreadyWarned.add(k);
6231
6188
  }
6232
- });
6233
- }
6234
-
6235
- /**
6236
- * A bit like Object.assign(), but just a shallow copy
6237
- * @private
6238
- * @param {any} target
6239
- * @param {any} source
6240
- * @return {any}
6241
- */
6242
- function shallowCopy(target, source) {
6243
- Object.keys(source).forEach(k => target[k] = source[k]);
6244
- return target;
6189
+ }
6245
6190
  }
6246
6191
  const israelCityOffset = {
6247
6192
  'Jerusalem': 40,
@@ -6719,7 +6664,7 @@ class HebrewCalendar {
6719
6664
  * @return {Event[]}
6720
6665
  */
6721
6666
  static calendar(options = {}) {
6722
- options = shallowCopy({}, options); // so we can modify freely
6667
+ options = Object.assign({}, options); // so we can modify freely
6723
6668
  checkCandleOptions(options);
6724
6669
  const location = options.location = options.location || defaultLocation;
6725
6670
  const il = options.il = options.il || location.il || false;
@@ -6768,9 +6713,9 @@ class HebrewCalendar {
6768
6713
  const dow = hd.getDay();
6769
6714
  let candlesEv;
6770
6715
  const ev = holidaysYear.get(hd.toString()) || [];
6771
- ev.forEach(e => {
6716
+ for (const e of ev) {
6772
6717
  candlesEv = appendHolidayAndRelated(evts, e, options, candlesEv, dow);
6773
- });
6718
+ }
6774
6719
  if (options.sedrot && dow === SAT) {
6775
6720
  const parsha0 = sedra.lookup(abs);
6776
6721
  if (!parsha0.chag) {
@@ -6779,8 +6724,7 @@ class HebrewCalendar {
6779
6724
  }
6780
6725
  const dailyLearning = options.dailyLearning;
6781
6726
  if (typeof dailyLearning === 'object') {
6782
- Object.keys(dailyLearning).forEach(key => {
6783
- const val = dailyLearning[key];
6727
+ for (const [key, val] of Object.entries(dailyLearning)) {
6784
6728
  if (val) {
6785
6729
  const name = key === 'yerushalmi' ? val === 2 ? 'yerushalmi-schottenstein' : 'yerushalmi-vilna' : key;
6786
6730
  const learningEv = DailyLearning.lookup(name, hd);
@@ -6788,7 +6732,7 @@ class HebrewCalendar {
6788
6732
  evts.push(learningEv);
6789
6733
  }
6790
6734
  }
6791
- });
6735
+ }
6792
6736
  }
6793
6737
  if (options.omer && abs >= beginOmer && abs <= endOmer) {
6794
6738
  const omer = abs - beginOmer + 1;
@@ -7082,12 +7026,10 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7082
7026
  if (!ev.observedIn(il)) {
7083
7027
  return candlesEv; // holiday isn't observed here; bail out early
7084
7028
  }
7085
-
7086
7029
  const eFlags = ev.getFlags();
7087
7030
  if (!options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN || options.noModern && eFlags & MODERN_HOLIDAY) {
7088
7031
  return candlesEv; // bail out early
7089
7032
  }
7090
-
7091
7033
  const location = options.location;
7092
7034
  const isMajorFast = Boolean(eFlags & MAJOR_FAST);
7093
7035
  const isMinorFast = Boolean(eFlags & MINOR_FAST);
@@ -7120,7 +7062,6 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7120
7062
  events.push(ev); // the original event itself
7121
7063
  }
7122
7064
  }
7123
-
7124
7065
  if (ev.endEvent && (isMajorFast || isMinorFast && !options.noMinorFast)) {
7125
7066
  events.push(ev.endEvent);
7126
7067
  }
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v5.0.0-rc6 */
1
+ /*! @hebcal/core v5.0.1 */
2
2
  const GERESH = '׳';
3
3
  const GERSHAYIM = '״';
4
4
  const heb2num = {
@@ -26,10 +26,9 @@ const heb2num = {
26
26
  'ת': 400
27
27
  };
28
28
  const num2heb = new Map();
29
- Object.keys(heb2num).forEach(key => {
30
- const val = heb2num[key];
29
+ for (const [key, val] of Object.entries(heb2num)) {
31
30
  num2heb.set(val, key);
32
- });
31
+ }
33
32
 
34
33
  /**
35
34
  * @private
@@ -249,9 +248,7 @@ class Locale {
249
248
  throw new TypeError(`Locale '${locale}' invalid compact format`);
250
249
  }
251
250
  const ctx = data.contexts[''];
252
- Object.keys(ctx).forEach(id => {
253
- loc[id] = ctx[id];
254
- });
251
+ Object.assign(loc, ctx);
255
252
  }
256
253
  /**
257
254
  * Activates a locale. Throws an error if the locale has not been previously added.
@@ -1154,7 +1151,7 @@ class HDate {
1154
1151
  * @private
1155
1152
  * @type {number}
1156
1153
  */
1157
- this.abs0 = abs0;
1154
+ this.rd = abs0;
1158
1155
  }
1159
1156
  }
1160
1157
  }
@@ -1255,10 +1252,10 @@ class HDate {
1255
1252
  * @return {number}
1256
1253
  */
1257
1254
  abs() {
1258
- if (typeof this.abs0 !== 'number') {
1259
- this.abs0 = hebrew2abs(this.yy, this.mm, this.dd);
1255
+ if (typeof this.rd !== 'number') {
1256
+ this.rd = hebrew2abs(this.yy, this.mm, this.dd);
1260
1257
  }
1261
- return this.abs0;
1258
+ return this.rd;
1262
1259
  }
1263
1260
 
1264
1261
  /**
@@ -1744,7 +1741,7 @@ function fixMonth(date) {
1744
1741
  date.yy += 1;
1745
1742
  fix(date);
1746
1743
  }
1747
- delete date.abs0;
1744
+ delete date.rd;
1748
1745
  }
1749
1746
 
1750
1747
  /**
@@ -1835,7 +1832,7 @@ class Event {
1835
1832
  this.desc = desc;
1836
1833
  this.mask = +mask;
1837
1834
  if (typeof attrs === 'object' && attrs !== null) {
1838
- Object.keys(attrs).forEach(k => this[k] = attrs[k]);
1835
+ Object.assign(this, attrs);
1839
1836
  }
1840
1837
  }
1841
1838
  /**
@@ -3428,10 +3425,10 @@ class Location extends GeoLocation {
3428
3425
  return true;
3429
3426
  }
3430
3427
  }
3431
- classicCities0.forEach(city => {
3428
+ for (const city of classicCities0) {
3432
3429
  const location = new Location(city[2], city[3], city[1] == 'IL', city[4], city[0], city[1], undefined, city[5]);
3433
3430
  Location.addLocation(location.getName(), location);
3434
- });
3431
+ }
3435
3432
 
3436
3433
  const _formatters = new Map();
3437
3434
 
@@ -3938,7 +3935,6 @@ function makeCandleEvent(e, hd, dow, location, options) {
3938
3935
  if (isNaN(time.getTime())) {
3939
3936
  return null; // no sunset
3940
3937
  }
3941
-
3942
3938
  if (havdalahTitle) {
3943
3939
  return new HavdalahEvent(hd, mask, time, location, options.havdalahMins, e);
3944
3940
  } else {
@@ -4573,7 +4569,6 @@ class Sedra {
4573
4569
  if (idx === -1) {
4574
4570
  return null; // doesn't occur this year
4575
4571
  }
4576
-
4577
4572
  return new HDate(this.firstSaturday + idx * 7);
4578
4573
  } else if (typeof parsha === 'string') {
4579
4574
  const num = parsha2id.get(parsha);
@@ -4587,7 +4582,6 @@ class Sedra {
4587
4582
  if (idx === -1) {
4588
4583
  return null; // doesn't occur this year
4589
4584
  }
4590
-
4591
4585
  return new HDate(this.firstSaturday + idx * 7);
4592
4586
  }
4593
4587
  } else if (Array.isArray(parsha) && parsha.length === 1 && typeof parsha[0] === 'string') {
@@ -4644,7 +4638,6 @@ class Sedra {
4644
4638
  const sedra = new Sedra(this.year + 1, this.il);
4645
4639
  return sedra.lookup(saturday); // must be next year
4646
4640
  }
4647
-
4648
4641
  if (typeof index === 'string') {
4649
4642
  // Shabbat has a chag. Return a description
4650
4643
  return {
@@ -5614,40 +5607,7 @@ const MINOR_HOLIDAY$1 = flags.MINOR_HOLIDAY;
5614
5607
  const EREV$1 = flags.EREV;
5615
5608
  // const CHOL_HAMOED = flags.CHOL_HAMOED;
5616
5609
 
5617
- /**
5618
- * Avoid dependency on ES6 Map object
5619
- * @private
5620
- */
5621
- class SimpleMap {
5622
- /**
5623
- * @param {string} key
5624
- * @return {boolean}
5625
- */
5626
- has(key) {
5627
- return typeof this[key] !== 'undefined';
5628
- }
5629
- /**
5630
- * @param {string} key
5631
- * @return {any}
5632
- */
5633
- get(key) {
5634
- return this[key];
5635
- }
5636
- /**
5637
- * @param {string} key
5638
- * @param {any} val
5639
- */
5640
- set(key, val) {
5641
- this[key] = val;
5642
- }
5643
- /**
5644
- * @return {string[]}
5645
- */
5646
- keys() {
5647
- return Object.keys(this);
5648
- }
5649
- }
5650
- const sedraCache = new SimpleMap();
5610
+ const sedraCache = new Map();
5651
5611
 
5652
5612
  /**
5653
5613
  * @private
@@ -5691,13 +5651,12 @@ function getHolidaysForYear_(year) {
5691
5651
  }
5692
5652
  const RH = new HDate(1, TISHREI$1, year);
5693
5653
  const pesach = new HDate(15, NISAN$1, year);
5694
- const h = new SimpleMap();
5654
+ const map = new Map();
5695
5655
  // eslint-disable-next-line require-jsdoc
5696
5656
  function add(...events) {
5697
- // for (const ev of events) {
5698
- events.forEach(ev => {
5657
+ for (const ev of events) {
5699
5658
  const key = ev.date.toString();
5700
- const arr = h.get(key);
5659
+ const arr = map.get(key);
5701
5660
  if (typeof arr === 'object') {
5702
5661
  if (arr[0].getFlags() & flags.EREV) {
5703
5662
  arr.unshift(ev);
@@ -5705,17 +5664,17 @@ function getHolidaysForYear_(year) {
5705
5664
  arr.push(ev);
5706
5665
  }
5707
5666
  } else {
5708
- h.set(key, [ev]);
5667
+ map.set(key, [ev]);
5709
5668
  }
5710
- });
5669
+ }
5711
5670
  }
5712
- staticHolidays.forEach(h => {
5671
+ for (const h of staticHolidays) {
5713
5672
  const hd = new HDate(h.dd, h.mm, year);
5714
5673
  const ev = new HolidayEvent(hd, h.desc, h.flags);
5715
5674
  if (h.emoji) ev.emoji = h.emoji;
5716
5675
  if (h.chmDay) ev.cholHaMoedDay = h.chmDay;
5717
5676
  add(ev);
5718
- });
5677
+ }
5719
5678
 
5720
5679
  // standard holidays that don't shift based on year
5721
5680
  add(new RoshHashanaEvent(RH, year, CHAG | LIGHT_CANDLES_TZEIS$1));
@@ -5767,7 +5726,7 @@ function getHolidaysForYear_(year) {
5767
5726
  if (yomHaZikaronDt) {
5768
5727
  add(new HolidayEvent(yomHaZikaronDt, 'Yom HaZikaron', MODERN_HOLIDAY$1, emojiIsraelFlag), new HolidayEvent(yomHaZikaronDt.next(), 'Yom HaAtzma\'ut', MODERN_HOLIDAY$1, emojiIsraelFlag));
5769
5728
  }
5770
- staticModernHolidays.forEach(h => {
5729
+ for (const h of staticModernHolidays) {
5771
5730
  if (year >= h.firstYear) {
5772
5731
  let hd = new HDate(h.dd, h.mm, year);
5773
5732
  const dow = hd.getDay();
@@ -5785,7 +5744,7 @@ function getHolidaysForYear_(year) {
5785
5744
  }
5786
5745
  add(ev);
5787
5746
  }
5788
- });
5747
+ }
5789
5748
  let tamuz17 = new HDate(17, TAMUZ, year);
5790
5749
  let tamuz17attrs;
5791
5750
  if (tamuz17.getDay() == SAT$1) {
@@ -5856,8 +5815,8 @@ function getHolidaysForYear_(year) {
5856
5815
  emoji: '☀️'
5857
5816
  }));
5858
5817
  }
5859
- yearCache.set(year, h);
5860
- return h;
5818
+ yearCache.set(year, map);
5819
+ return map;
5861
5820
  }
5862
5821
 
5863
5822
  /**
@@ -5924,7 +5883,7 @@ class DailyLearning {
5924
5883
  }
5925
5884
  }
5926
5885
 
5927
- const version="5.0.0-rc6";
5886
+ const version="5.0.1";
5928
5887
 
5929
5888
  const headers$1={"plural-forms":"nplurals=2; plural=(n > 1);"};const contexts$1={"":{Shabbat:["Shabbos"],"Achrei Mot":["Achrei Mos"],Bechukotai:["Bechukosai"],"Beha'alotcha":["Beha'aloscha"],Bereshit:["Bereshis"],Chukat:["Chukas"],"Erev Shavuot":["Erev Shavuos"],"Erev Sukkot":["Erev Sukkos"],"Ki Tavo":["Ki Savo"],"Ki Teitzei":["Ki Seitzei"],"Ki Tisa":["Ki Sisa"],Matot:["Matos"],"Purim Katan":["Purim Koton"],"Shabbat Chazon":["Shabbos Chazon"],"Shabbat HaChodesh":["Shabbos HaChodesh"],"Shabbat HaGadol":["Shabbos HaGadol"],"Shabbat Nachamu":["Shabbos Nachamu"],"Shabbat Parah":["Shabbos Parah"],"Shabbat Shekalim":["Shabbos Shekalim"],"Shabbat Shuva":["Shabbos Shuvah"],"Shabbat Zachor":["Shabbos Zachor"],Shavuot:["Shavuos"],"Shavuot I":["Shavuos I"],"Shavuot II":["Shavuos II"],Shemot:["Shemos"],"Shmini Atzeret":["Shmini Atzeres"],"Simchat Torah":["Simchas Torah"],Sukkot:["Sukkos"],"Sukkot I":["Sukkos I"],"Sukkot II":["Sukkos II"],"Sukkot II (CH''M)":["Sukkos II (CH''M)"],"Sukkot III (CH''M)":["Sukkos III (CH''M)"],"Sukkot IV (CH''M)":["Sukkos IV (CH''M)"],"Sukkot V (CH''M)":["Sukkos V (CH''M)"],"Sukkot VI (CH''M)":["Sukkos VI (CH''M)"],"Sukkot VII (Hoshana Raba)":["Sukkos VII (Hoshana Raba)"],"Ta'anit Bechorot":["Ta'anis Bechoros"],"Ta'anit Esther":["Ta'anis Esther"],Toldot:["Toldos"],Vaetchanan:["Vaeschanan"],Yitro:["Yisro"],"Vezot Haberakhah":["Vezos Haberakhah"],Parashat:["Parshas"],"Leil Selichot":["Leil Selichos"],"Shabbat Mevarchim Chodesh":["Shabbos Mevorchim Chodesh"],"Shabbat Shirah":["Shabbos Shirah"],Tevet:["Teves"],"Asara B'Tevet":["Asara B'Teves"],"Alot HaShachar":["Alos HaShachar"],"Kriat Shema, sof zeman":["Krias Shema, sof zman"],"Tefilah, sof zeman":["Tefilah, sof zman"],"Kriat Shema, sof zeman (MGA)":["Krias Shema, sof zman (MGA)"],"Tefilah, sof zeman (MGA)":["Tefilah, sof zman (MGA)"],"Chatzot HaLailah":["Chatzos HaLailah"],"Chatzot hayom":["Chatzos"],"Tzeit HaKochavim":["Tzeis HaKochavim"],"Birkat Hachamah":["Birkas Hachamah"],"Shushan Purim Katan":["Shushan Purim Koton"]}};var poAshkenazi = {headers:headers$1,contexts:contexts$1};
5930
5889
 
@@ -5937,9 +5896,9 @@ Locale.addLocale('he', poHe);
5937
5896
  Locale.addLocale('h', poHe);
5938
5897
  const heStrs = poHe.contexts[''];
5939
5898
  const heNoNikud = {};
5940
- Object.keys(heStrs).forEach(key => {
5941
- heNoNikud[key] = [Locale.hebrewStripNikkud(heStrs[key][0])];
5942
- });
5899
+ for (const [key, val] of Object.entries(heStrs)) {
5900
+ heNoNikud[key] = [Locale.hebrewStripNikkud(val[0])];
5901
+ }
5943
5902
  const poHeNoNikud = {
5944
5903
  headers: poHe.headers,
5945
5904
  contexts: {
@@ -6104,7 +6063,6 @@ function tachanunYear(year, il) {
6104
6063
  // Purim
6105
6064
  shushPurim, leap ? new HDate(14, months.ADAR_I, year) : [] // Purim Katan
6106
6065
  );
6107
-
6108
6066
  const some = [].concat(
6109
6067
  // Until 14 Sivan
6110
6068
  range(1, 13).map(mday => new HDate(mday, months.SIVAN, year)),
@@ -6121,7 +6079,6 @@ function tachanunYear(year, il) {
6121
6079
  // Erev Yom Kippur
6122
6080
  new HDate(14, months.IYYAR, year) // Pesach Sheini
6123
6081
  );
6124
-
6125
6082
  return {
6126
6083
  none: none.map(hd => hd.abs()).sort((a, b) => a - b),
6127
6084
  some: some.map(hd => hd.abs()).sort((a, b) => a - b),
@@ -6222,24 +6179,12 @@ const RECOGNIZED_OPTIONS = {
6222
6179
  * @param {CalOptions} options
6223
6180
  */
6224
6181
  function warnUnrecognizedOptions(options) {
6225
- Object.keys(options).forEach(k => {
6182
+ for (const k of Object.keys(options)) {
6226
6183
  if (typeof RECOGNIZED_OPTIONS[k] === 'undefined' && !unrecognizedAlreadyWarned.has(k)) {
6227
6184
  console.warn(`Ignoring unrecognized HebrewCalendar option: ${k}`);
6228
6185
  unrecognizedAlreadyWarned.add(k);
6229
6186
  }
6230
- });
6231
- }
6232
-
6233
- /**
6234
- * A bit like Object.assign(), but just a shallow copy
6235
- * @private
6236
- * @param {any} target
6237
- * @param {any} source
6238
- * @return {any}
6239
- */
6240
- function shallowCopy(target, source) {
6241
- Object.keys(source).forEach(k => target[k] = source[k]);
6242
- return target;
6187
+ }
6243
6188
  }
6244
6189
  const israelCityOffset = {
6245
6190
  'Jerusalem': 40,
@@ -6717,7 +6662,7 @@ class HebrewCalendar {
6717
6662
  * @return {Event[]}
6718
6663
  */
6719
6664
  static calendar(options = {}) {
6720
- options = shallowCopy({}, options); // so we can modify freely
6665
+ options = Object.assign({}, options); // so we can modify freely
6721
6666
  checkCandleOptions(options);
6722
6667
  const location = options.location = options.location || defaultLocation;
6723
6668
  const il = options.il = options.il || location.il || false;
@@ -6766,9 +6711,9 @@ class HebrewCalendar {
6766
6711
  const dow = hd.getDay();
6767
6712
  let candlesEv;
6768
6713
  const ev = holidaysYear.get(hd.toString()) || [];
6769
- ev.forEach(e => {
6714
+ for (const e of ev) {
6770
6715
  candlesEv = appendHolidayAndRelated(evts, e, options, candlesEv, dow);
6771
- });
6716
+ }
6772
6717
  if (options.sedrot && dow === SAT) {
6773
6718
  const parsha0 = sedra.lookup(abs);
6774
6719
  if (!parsha0.chag) {
@@ -6777,8 +6722,7 @@ class HebrewCalendar {
6777
6722
  }
6778
6723
  const dailyLearning = options.dailyLearning;
6779
6724
  if (typeof dailyLearning === 'object') {
6780
- Object.keys(dailyLearning).forEach(key => {
6781
- const val = dailyLearning[key];
6725
+ for (const [key, val] of Object.entries(dailyLearning)) {
6782
6726
  if (val) {
6783
6727
  const name = key === 'yerushalmi' ? val === 2 ? 'yerushalmi-schottenstein' : 'yerushalmi-vilna' : key;
6784
6728
  const learningEv = DailyLearning.lookup(name, hd);
@@ -6786,7 +6730,7 @@ class HebrewCalendar {
6786
6730
  evts.push(learningEv);
6787
6731
  }
6788
6732
  }
6789
- });
6733
+ }
6790
6734
  }
6791
6735
  if (options.omer && abs >= beginOmer && abs <= endOmer) {
6792
6736
  const omer = abs - beginOmer + 1;
@@ -7080,12 +7024,10 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7080
7024
  if (!ev.observedIn(il)) {
7081
7025
  return candlesEv; // holiday isn't observed here; bail out early
7082
7026
  }
7083
-
7084
7027
  const eFlags = ev.getFlags();
7085
7028
  if (!options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN || options.noModern && eFlags & MODERN_HOLIDAY) {
7086
7029
  return candlesEv; // bail out early
7087
7030
  }
7088
-
7089
7031
  const location = options.location;
7090
7032
  const isMajorFast = Boolean(eFlags & MAJOR_FAST);
7091
7033
  const isMinorFast = Boolean(eFlags & MINOR_FAST);
@@ -7118,7 +7060,6 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
7118
7060
  events.push(ev); // the original event itself
7119
7061
  }
7120
7062
  }
7121
-
7122
7063
  if (ev.endEvent && (isMajorFast || isMinorFast && !options.noMinorFast)) {
7123
7064
  events.push(ev.endEvent);
7124
7065
  }