@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/bundle.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v5.0.0-rc6 */
1
+ /*! @hebcal/core v5.0.1 */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -29,10 +29,9 @@ const heb2num = {
29
29
  'ת': 400
30
30
  };
31
31
  const num2heb = new Map();
32
- Object.keys(heb2num).forEach(key => {
33
- const val = heb2num[key];
32
+ for (const [key, val] of Object.entries(heb2num)) {
34
33
  num2heb.set(val, key);
35
- });
34
+ }
36
35
 
37
36
  /**
38
37
  * @private
@@ -252,9 +251,7 @@ class Locale {
252
251
  throw new TypeError(`Locale '${locale}' invalid compact format`);
253
252
  }
254
253
  const ctx = data.contexts[''];
255
- Object.keys(ctx).forEach(id => {
256
- loc[id] = ctx[id];
257
- });
254
+ Object.assign(loc, ctx);
258
255
  }
259
256
  /**
260
257
  * Activates a locale. Throws an error if the locale has not been previously added.
@@ -781,7 +778,6 @@ function monthFromName(monthName) {
781
778
  if (c[1] == 'o') {
782
779
  break; /* this catches "november" */
783
780
  }
784
-
785
781
  return months.NISAN;
786
782
  case 'i':
787
783
  return months.IYYAR;
@@ -1098,7 +1094,7 @@ class HDate {
1098
1094
  * @private
1099
1095
  * @type {number}
1100
1096
  */
1101
- this.abs0 = abs0;
1097
+ this.rd = abs0;
1102
1098
  }
1103
1099
  }
1104
1100
  }
@@ -1199,10 +1195,10 @@ class HDate {
1199
1195
  * @return {number}
1200
1196
  */
1201
1197
  abs() {
1202
- if (typeof this.abs0 !== 'number') {
1203
- this.abs0 = hebrew2abs(this.yy, this.mm, this.dd);
1198
+ if (typeof this.rd !== 'number') {
1199
+ this.rd = hebrew2abs(this.yy, this.mm, this.dd);
1204
1200
  }
1205
- return this.abs0;
1201
+ return this.rd;
1206
1202
  }
1207
1203
 
1208
1204
  /**
@@ -1694,7 +1690,7 @@ function fixMonth(date) {
1694
1690
  date.yy += 1;
1695
1691
  fix(date);
1696
1692
  }
1697
- delete date.abs0;
1693
+ delete date.rd;
1698
1694
  }
1699
1695
 
1700
1696
  /**
@@ -1785,7 +1781,7 @@ class Event {
1785
1781
  this.desc = desc;
1786
1782
  this.mask = +mask;
1787
1783
  if (typeof attrs === 'object' && attrs !== null) {
1788
- Object.keys(attrs).forEach(k => this[k] = attrs[k]);
1784
+ Object.assign(this, attrs);
1789
1785
  }
1790
1786
  }
1791
1787
  /**
@@ -6575,10 +6571,10 @@ class Location extends GeoLocation {
6575
6571
  return true;
6576
6572
  }
6577
6573
  }
6578
- classicCities0.forEach(city => {
6574
+ for (const city of classicCities0) {
6579
6575
  const location = new Location(city[2], city[3], city[1] == 'IL', city[4], city[0], city[1], undefined, city[5]);
6580
6576
  Location.addLocation(location.getName(), location);
6581
- });
6577
+ }
6582
6578
 
6583
6579
  const _formatters = new Map();
6584
6580
 
@@ -7092,7 +7088,6 @@ function makeCandleEvent(e, hd, dow, location, options) {
7092
7088
  if (isNaN(time.getTime())) {
7093
7089
  return null; // no sunset
7094
7090
  }
7095
-
7096
7091
  if (havdalahTitle) {
7097
7092
  return new HavdalahEvent(hd, mask, time, location, options.havdalahMins, e);
7098
7093
  } else {
@@ -7728,7 +7723,6 @@ class Sedra {
7728
7723
  if (idx === -1) {
7729
7724
  return null; // doesn't occur this year
7730
7725
  }
7731
-
7732
7726
  return new HDate(this.firstSaturday + idx * 7);
7733
7727
  } else if (typeof parsha === 'string') {
7734
7728
  const num = parsha2id.get(parsha);
@@ -7742,7 +7736,6 @@ class Sedra {
7742
7736
  if (idx === -1) {
7743
7737
  return null; // doesn't occur this year
7744
7738
  }
7745
-
7746
7739
  return new HDate(this.firstSaturday + idx * 7);
7747
7740
  }
7748
7741
  } else if (Array.isArray(parsha) && parsha.length === 1 && typeof parsha[0] === 'string') {
@@ -7799,7 +7792,6 @@ class Sedra {
7799
7792
  const sedra = new Sedra(this.year + 1, this.il);
7800
7793
  return sedra.lookup(saturday); // must be next year
7801
7794
  }
7802
-
7803
7795
  if (typeof index === 'string') {
7804
7796
  // Shabbat has a chag. Return a description
7805
7797
  return {
@@ -8434,10 +8426,10 @@ var store$1 = sharedStore;
8434
8426
  (shared$3.exports = function (key, value) {
8435
8427
  return store$1[key] || (store$1[key] = value !== undefined ? value : {});
8436
8428
  })('versions', []).push({
8437
- version: '3.33.3',
8429
+ version: '3.34.0',
8438
8430
  mode: 'global',
8439
8431
  copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
8440
- license: 'https://github.com/zloirock/core-js/blob/v3.33.3/LICENSE',
8432
+ license: 'https://github.com/zloirock/core-js/blob/v3.34.0/LICENSE',
8441
8433
  source: 'https://github.com/zloirock/core-js'
8442
8434
  });
8443
8435
 
@@ -9495,40 +9487,7 @@ const MINOR_HOLIDAY$1 = flags.MINOR_HOLIDAY;
9495
9487
  const EREV$1 = flags.EREV;
9496
9488
  // const CHOL_HAMOED = flags.CHOL_HAMOED;
9497
9489
 
9498
- /**
9499
- * Avoid dependency on ES6 Map object
9500
- * @private
9501
- */
9502
- class SimpleMap {
9503
- /**
9504
- * @param {string} key
9505
- * @return {boolean}
9506
- */
9507
- has(key) {
9508
- return typeof this[key] !== 'undefined';
9509
- }
9510
- /**
9511
- * @param {string} key
9512
- * @return {any}
9513
- */
9514
- get(key) {
9515
- return this[key];
9516
- }
9517
- /**
9518
- * @param {string} key
9519
- * @param {any} val
9520
- */
9521
- set(key, val) {
9522
- this[key] = val;
9523
- }
9524
- /**
9525
- * @return {string[]}
9526
- */
9527
- keys() {
9528
- return Object.keys(this);
9529
- }
9530
- }
9531
- const sedraCache = new SimpleMap();
9490
+ const sedraCache = new Map();
9532
9491
 
9533
9492
  /**
9534
9493
  * @private
@@ -9572,16 +9531,15 @@ function getHolidaysForYear_(year) {
9572
9531
  }
9573
9532
  const RH = new HDate(1, TISHREI$1, year);
9574
9533
  const pesach = new HDate(15, NISAN$1, year);
9575
- const h = new SimpleMap();
9534
+ const map = new Map();
9576
9535
  // eslint-disable-next-line require-jsdoc
9577
9536
  function add() {
9578
9537
  for (var _len = arguments.length, events = new Array(_len), _key = 0; _key < _len; _key++) {
9579
9538
  events[_key] = arguments[_key];
9580
9539
  }
9581
- // for (const ev of events) {
9582
- events.forEach(ev => {
9540
+ for (const ev of events) {
9583
9541
  const key = ev.date.toString();
9584
- const arr = h.get(key);
9542
+ const arr = map.get(key);
9585
9543
  if (typeof arr === 'object') {
9586
9544
  if (arr[0].getFlags() & flags.EREV) {
9587
9545
  arr.unshift(ev);
@@ -9589,17 +9547,17 @@ function getHolidaysForYear_(year) {
9589
9547
  arr.push(ev);
9590
9548
  }
9591
9549
  } else {
9592
- h.set(key, [ev]);
9550
+ map.set(key, [ev]);
9593
9551
  }
9594
- });
9552
+ }
9595
9553
  }
9596
- staticHolidays.forEach(h => {
9554
+ for (const h of staticHolidays) {
9597
9555
  const hd = new HDate(h.dd, h.mm, year);
9598
9556
  const ev = new HolidayEvent(hd, h.desc, h.flags);
9599
9557
  if (h.emoji) ev.emoji = h.emoji;
9600
9558
  if (h.chmDay) ev.cholHaMoedDay = h.chmDay;
9601
9559
  add(ev);
9602
- });
9560
+ }
9603
9561
 
9604
9562
  // standard holidays that don't shift based on year
9605
9563
  add(new RoshHashanaEvent(RH, year, CHAG | LIGHT_CANDLES_TZEIS$1));
@@ -9651,7 +9609,7 @@ function getHolidaysForYear_(year) {
9651
9609
  if (yomHaZikaronDt) {
9652
9610
  add(new HolidayEvent(yomHaZikaronDt, 'Yom HaZikaron', MODERN_HOLIDAY$1, emojiIsraelFlag), new HolidayEvent(yomHaZikaronDt.next(), 'Yom HaAtzma\'ut', MODERN_HOLIDAY$1, emojiIsraelFlag));
9653
9611
  }
9654
- staticModernHolidays.forEach(h => {
9612
+ for (const h of staticModernHolidays) {
9655
9613
  if (year >= h.firstYear) {
9656
9614
  let hd = new HDate(h.dd, h.mm, year);
9657
9615
  const dow = hd.getDay();
@@ -9669,7 +9627,7 @@ function getHolidaysForYear_(year) {
9669
9627
  }
9670
9628
  add(ev);
9671
9629
  }
9672
- });
9630
+ }
9673
9631
  let tamuz17 = new HDate(17, TAMUZ, year);
9674
9632
  let tamuz17attrs;
9675
9633
  if (tamuz17.getDay() == SAT$1) {
@@ -9740,8 +9698,8 @@ function getHolidaysForYear_(year) {
9740
9698
  emoji: '☀️'
9741
9699
  }));
9742
9700
  }
9743
- yearCache.set(year, h);
9744
- return h;
9701
+ yearCache.set(year, map);
9702
+ return map;
9745
9703
  }
9746
9704
 
9747
9705
  /**
@@ -9808,7 +9766,7 @@ class DailyLearning {
9808
9766
  }
9809
9767
  }
9810
9768
 
9811
- const version="5.0.0-rc6";
9769
+ const version="5.0.1";
9812
9770
 
9813
9771
  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};
9814
9772
 
@@ -9821,9 +9779,9 @@ Locale.addLocale('he', poHe);
9821
9779
  Locale.addLocale('h', poHe);
9822
9780
  const heStrs = poHe.contexts[''];
9823
9781
  const heNoNikud = {};
9824
- Object.keys(heStrs).forEach(key => {
9825
- heNoNikud[key] = [Locale.hebrewStripNikkud(heStrs[key][0])];
9826
- });
9782
+ for (const [key, val] of Object.entries(heStrs)) {
9783
+ heNoNikud[key] = [Locale.hebrewStripNikkud(val[0])];
9784
+ }
9827
9785
  const poHeNoNikud = {
9828
9786
  headers: poHe.headers,
9829
9787
  contexts: {
@@ -10500,7 +10458,6 @@ function tachanunYear(year, il) {
10500
10458
  // Purim
10501
10459
  shushPurim, leap ? new HDate(14, months.ADAR_I, year) : [] // Purim Katan
10502
10460
  );
10503
-
10504
10461
  const some = [].concat(
10505
10462
  // Until 14 Sivan
10506
10463
  range(1, 13).map(mday => new HDate(mday, months.SIVAN, year)),
@@ -10517,7 +10474,6 @@ function tachanunYear(year, il) {
10517
10474
  // Erev Yom Kippur
10518
10475
  new HDate(14, months.IYYAR, year) // Pesach Sheini
10519
10476
  );
10520
-
10521
10477
  return {
10522
10478
  none: none.map(hd => hd.abs()).sort((a, b) => a - b),
10523
10479
  some: some.map(hd => hd.abs()).sort((a, b) => a - b),
@@ -10618,24 +10574,12 @@ const RECOGNIZED_OPTIONS = {
10618
10574
  * @param {CalOptions} options
10619
10575
  */
10620
10576
  function warnUnrecognizedOptions(options) {
10621
- Object.keys(options).forEach(k => {
10577
+ for (const k of Object.keys(options)) {
10622
10578
  if (typeof RECOGNIZED_OPTIONS[k] === 'undefined' && !unrecognizedAlreadyWarned.has(k)) {
10623
10579
  console.warn(`Ignoring unrecognized HebrewCalendar option: ${k}`);
10624
10580
  unrecognizedAlreadyWarned.add(k);
10625
10581
  }
10626
- });
10627
- }
10628
-
10629
- /**
10630
- * A bit like Object.assign(), but just a shallow copy
10631
- * @private
10632
- * @param {any} target
10633
- * @param {any} source
10634
- * @return {any}
10635
- */
10636
- function shallowCopy(target, source) {
10637
- Object.keys(source).forEach(k => target[k] = source[k]);
10638
- return target;
10582
+ }
10639
10583
  }
10640
10584
  const israelCityOffset = {
10641
10585
  'Jerusalem': 40,
@@ -11114,7 +11058,7 @@ class HebrewCalendar {
11114
11058
  */
11115
11059
  static calendar() {
11116
11060
  let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
11117
- options = shallowCopy({}, options); // so we can modify freely
11061
+ options = Object.assign({}, options); // so we can modify freely
11118
11062
  checkCandleOptions(options);
11119
11063
  const location = options.location = options.location || defaultLocation;
11120
11064
  const il = options.il = options.il || location.il || false;
@@ -11163,9 +11107,9 @@ class HebrewCalendar {
11163
11107
  const dow = hd.getDay();
11164
11108
  let candlesEv;
11165
11109
  const ev = holidaysYear.get(hd.toString()) || [];
11166
- ev.forEach(e => {
11110
+ for (const e of ev) {
11167
11111
  candlesEv = appendHolidayAndRelated(evts, e, options, candlesEv, dow);
11168
- });
11112
+ }
11169
11113
  if (options.sedrot && dow === SAT) {
11170
11114
  const parsha0 = sedra.lookup(abs);
11171
11115
  if (!parsha0.chag) {
@@ -11174,8 +11118,7 @@ class HebrewCalendar {
11174
11118
  }
11175
11119
  const dailyLearning = options.dailyLearning;
11176
11120
  if (typeof dailyLearning === 'object') {
11177
- Object.keys(dailyLearning).forEach(key => {
11178
- const val = dailyLearning[key];
11121
+ for (const [key, val] of Object.entries(dailyLearning)) {
11179
11122
  if (val) {
11180
11123
  const name = key === 'yerushalmi' ? val === 2 ? 'yerushalmi-schottenstein' : 'yerushalmi-vilna' : key;
11181
11124
  const learningEv = DailyLearning.lookup(name, hd);
@@ -11183,7 +11126,7 @@ class HebrewCalendar {
11183
11126
  evts.push(learningEv);
11184
11127
  }
11185
11128
  }
11186
- });
11129
+ }
11187
11130
  }
11188
11131
  if (options.omer && abs >= beginOmer && abs <= endOmer) {
11189
11132
  const omer = abs - beginOmer + 1;
@@ -11477,12 +11420,10 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
11477
11420
  if (!ev.observedIn(il)) {
11478
11421
  return candlesEv; // holiday isn't observed here; bail out early
11479
11422
  }
11480
-
11481
11423
  const eFlags = ev.getFlags();
11482
11424
  if (!options.yomKippurKatan && eFlags & YOM_KIPPUR_KATAN || options.noModern && eFlags & MODERN_HOLIDAY) {
11483
11425
  return candlesEv; // bail out early
11484
11426
  }
11485
-
11486
11427
  const location = options.location;
11487
11428
  const isMajorFast = Boolean(eFlags & MAJOR_FAST);
11488
11429
  const isMinorFast = Boolean(eFlags & MINOR_FAST);
@@ -11515,7 +11456,6 @@ function appendHolidayAndRelated(events, ev, options, candlesEv, dow) {
11515
11456
  events.push(ev); // the original event itself
11516
11457
  }
11517
11458
  }
11518
-
11519
11459
  if (ev.endEvent && (isMajorFast || isMinorFast && !options.noMinorFast)) {
11520
11460
  events.push(ev.endEvent);
11521
11461
  }