@hebcal/core 4.0.2 → 4.1.0

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 v4.0.2 */
1
+ /*! @hebcal/core v4.1.0 */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -1994,12 +1994,70 @@ var Locale = /*#__PURE__*/function () {
1994
1994
  }, {
1995
1995
  key: "addLocale",
1996
1996
  value: function addLocale(locale, data) {
1997
+ if (typeof locale !== 'string') {
1998
+ throw new TypeError("Invalid locale name: ".concat(locale));
1999
+ }
1997
2000
  if (_typeof(data.contexts) !== 'object' || _typeof(data.contexts['']) !== 'object') {
1998
2001
  throw new TypeError("Locale '".concat(locale, "' invalid compact format"));
1999
2002
  }
2000
2003
  locales[locale.toLowerCase()] = data.contexts[''];
2001
2004
  }
2002
2005
 
2006
+ /**
2007
+ * Adds a translation to `locale`, replacing any previous translation.
2008
+ * @param {string} locale Locale name (i.e: `'he'`, `'fr'`).
2009
+ * @param {string} id Message ID to translate
2010
+ * @param {string} translation Translation text
2011
+ */
2012
+ }, {
2013
+ key: "addTranslation",
2014
+ value: function addTranslation(locale, id, translation) {
2015
+ if (typeof locale !== 'string') {
2016
+ throw new TypeError("Invalid locale name: ".concat(locale));
2017
+ }
2018
+ var locale0 = locale.toLowerCase();
2019
+ var loc = locales[locale0];
2020
+ if (!loc) {
2021
+ throw new TypeError("Unknown locale: ".concat(locale));
2022
+ }
2023
+ if (typeof id !== 'string' || id.length === 0) {
2024
+ throw new TypeError("Invalid id: ".concat(id));
2025
+ }
2026
+ var isArray = Array.isArray(translation);
2027
+ if (isArray) {
2028
+ var t0 = translation[0];
2029
+ if (typeof t0 !== 'string' || t0.length === 0) {
2030
+ throw new TypeError("Invalid translation array: ".concat(translation));
2031
+ }
2032
+ } else if (typeof translation !== 'string') {
2033
+ throw new TypeError("Invalid translation: ".concat(translation));
2034
+ }
2035
+ loc[id] = isArray ? translation : [translation];
2036
+ }
2037
+ /**
2038
+ * Adds multiple translations to `locale`, replacing any previous translations.
2039
+ * @param {string} locale Locale name (i.e: `'he'`, `'fr'`).
2040
+ * @param {LocaleData} data parsed data from a `.po` file.
2041
+ */
2042
+ }, {
2043
+ key: "addTranslations",
2044
+ value: function addTranslations(locale, data) {
2045
+ if (typeof locale !== 'string') {
2046
+ throw new TypeError("Invalid locale name: ".concat(locale));
2047
+ }
2048
+ var locale0 = locale.toLowerCase();
2049
+ var loc = locales[locale0];
2050
+ if (!loc) {
2051
+ throw new TypeError("Unknown locale: ".concat(locale));
2052
+ }
2053
+ if (_typeof(data.contexts) !== 'object' || _typeof(data.contexts['']) !== 'object') {
2054
+ throw new TypeError("Locale '".concat(locale, "' invalid compact format"));
2055
+ }
2056
+ var ctx = data.contexts[''];
2057
+ Object.keys(ctx).forEach(function (id) {
2058
+ loc[id] = ctx[id];
2059
+ });
2060
+ }
2003
2061
  /**
2004
2062
  * Activates a locale. Throws an error if the locale has not been previously added.
2005
2063
  * After setting the locale to be used, all strings marked for translations
@@ -6808,7 +6866,7 @@ var HolidayEvent = /*#__PURE__*/function (_Event) {
6808
6866
  }, {
6809
6867
  key: "getCategories",
6810
6868
  value: function getCategories() {
6811
- if (ev.cholHaMoedDay) {
6869
+ if (this.cholHaMoedDay) {
6812
6870
  return ['holiday', 'major', 'cholhamoed'];
6813
6871
  }
6814
6872
  var cats = _get(_getPrototypeOf(HolidayEvent.prototype), "getCategories", this).call(this);
@@ -7254,11 +7312,11 @@ function getHolidaysForYear_(year) {
7254
7312
  _hd = _hd.next();
7255
7313
  }
7256
7314
  var mask = h.chul ? MODERN_HOLIDAY$1 : MODERN_HOLIDAY$1 | flags.IL_ONLY;
7257
- var _ev = new HolidayEvent(_hd, h.desc, mask);
7315
+ var ev = new HolidayEvent(_hd, h.desc, mask);
7258
7316
  if (!h.suppressEmoji) {
7259
- _ev.emoji = '🇮🇱';
7317
+ ev.emoji = '🇮🇱';
7260
7318
  }
7261
- add(_ev);
7319
+ add(ev);
7262
7320
  }
7263
7321
  });
7264
7322
  var tamuz17 = new HDate(17, TAMUZ, year);
@@ -7316,8 +7374,8 @@ function getHolidaysForYear_(year) {
7316
7374
  _ykk = _ykk.onOrBefore(THU);
7317
7375
  }
7318
7376
  var _nextMonthName = HDate.getMonthName(nextMonth, year);
7319
- var _ev2 = new YomKippurKatanEvent(_ykk, _nextMonthName);
7320
- add(_ev2);
7377
+ var ev = new YomKippurKatanEvent(_ykk, _nextMonthName);
7378
+ add(ev);
7321
7379
  }
7322
7380
  var sedra = getSedra_(year, false);
7323
7381
  var beshalachHd = sedra.find(15);
@@ -7555,7 +7613,7 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
7555
7613
  return new HDate(day, month, hyear);
7556
7614
  }
7557
7615
 
7558
- var version="4.0.2";
7616
+ var version="4.1.0";
7559
7617
 
7560
7618
  var headers$1={"plural-forms":"nplurals=2; plural=(n > 1);"};var contexts$1={"":{Berachot:["Berachos"],Shabbat:["Shabbos"],Taanit:["Taanis"],Yevamot:["Yevamos"],Ketubot:["Kesubos"],"Baba Batra":["Baba Basra"],Makkot:["Makkos"],Shevuot:["Shevuos"],Horayot:["Horayos"],Menachot:["Menachos"],Bechorot:["Bechoros"],Keritot:["Kerisos"],Midot:["Midos"],"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"],Tazria:["Sazria"],"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"],Berakhot:["Berakhos"],Sheviit:["Sheviis"],Terumot:["Terumos"],Maasrot:["Maasros"],Eduyot:["Eduyos"],Avot:["Avos"],Bekhorot:["Bekhoros"],Middot:["Middos"],Oholot:["Oholos"],Tahorot:["Tahoros"],Mikvaot:["Mikvaos"],"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};
7561
7619