@hebcal/core 4.2.0 → 4.3.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/README.md CHANGED
@@ -344,6 +344,7 @@ Represents a Hebrew date
344
344
  * [.monthFromName(monthName)](#HDate.monthFromName) ⇒ <code>number</code>
345
345
  * [.dayOnOrBefore(dayOfWeek, absdate)](#HDate.dayOnOrBefore) ⇒ <code>number</code>
346
346
  * [.isHDate(obj)](#HDate.isHDate) ⇒ <code>boolean</code>
347
+ * [.fromGematriyaString(str, currentThousands)](#HDate.fromGematriyaString) ⇒ [<code>HDate</code>](#HDate)
347
348
 
348
349
  <a name="new_HDate_new"></a>
349
350
 
@@ -815,6 +816,24 @@ Tests if the object is an instance of `HDate`
815
816
  | --- | --- |
816
817
  | obj | <code>any</code> |
817
818
 
819
+ <a name="HDate.fromGematriyaString"></a>
820
+
821
+ ### HDate.fromGematriyaString(str, currentThousands) ⇒ [<code>HDate</code>](#HDate)
822
+ Construct a new instance of `HDate` from a Gematriya-formatted string
823
+
824
+ **Kind**: static method of [<code>HDate</code>](#HDate)
825
+
826
+ | Param | Type | Default |
827
+ | --- | --- | --- |
828
+ | str | <code>string</code> | |
829
+ | currentThousands | <code>number</code> | <code>5000</code> |
830
+
831
+ **Example**
832
+ ```js
833
+ HDate.fromGematriyaString('כ״ז בְּתַמּוּז תשפ״ג') // 27 Tamuz 5783
834
+ HDate.fromGematriyaString('כ׳ סיון תש״ד') // 20 Sivan 5704
835
+ HDate.fromGematriyaString('ה׳ אִיָיר תש״ח') // 5 Iyyar 5708
836
+ ```
818
837
  <a name="Event"></a>
819
838
 
820
839
  ## Event
package/dist/bundle.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v4.2.0 */
1
+ /*! @hebcal/core v4.3.1 */
2
2
  var hebcal = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -142,7 +142,7 @@ function _toPropertyKey(arg) {
142
142
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
143
143
 
144
144
  var check = function (it) {
145
- return it && it.Math == Math && it;
145
+ return it && it.Math === Math && it;
146
146
  };
147
147
 
148
148
  // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
@@ -171,7 +171,7 @@ var fails$e = fails$f;
171
171
  // Detect IE8's incomplete defineProperty implementation
172
172
  var descriptors = !fails$e(function () {
173
173
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
174
- return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
174
+ return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
175
175
  });
176
176
 
177
177
  var fails$d = fails$f;
@@ -250,7 +250,7 @@ var indexedObject = fails$c(function () {
250
250
  // eslint-disable-next-line no-prototype-builtins -- safe
251
251
  return !$Object$3('z').propertyIsEnumerable(0);
252
252
  }) ? function (it) {
253
- return classof$6(it) == 'String' ? split(it, '') : $Object$3(it);
253
+ return classof$6(it) === 'String' ? split(it, '') : $Object$3(it);
254
254
  } : $Object$3;
255
255
 
256
256
  // we can't use just `it == null` since of `document.all` special case
@@ -358,7 +358,6 @@ if (!version$1 && userAgent$2) {
358
358
  var engineV8Version = version$1;
359
359
 
360
360
  /* eslint-disable es/no-symbol -- required for testing */
361
-
362
361
  var V8_VERSION$1 = engineV8Version;
363
362
  var fails$b = fails$f;
364
363
  var global$9 = global$c;
@@ -367,7 +366,7 @@ var $String$4 = global$9.String;
367
366
 
368
367
  // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
369
368
  var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$b(function () {
370
- var symbol = Symbol();
369
+ var symbol = Symbol('symbol detection');
371
370
  // Chrome 38 Symbol has incorrect toString conversion
372
371
  // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
373
372
  // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
@@ -378,7 +377,6 @@ var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$b(func
378
377
  });
379
378
 
380
379
  /* eslint-disable es/no-symbol -- required for testing */
381
-
382
380
  var NATIVE_SYMBOL$1 = symbolConstructorDetection;
383
381
 
384
382
  var useSymbolAsUid = NATIVE_SYMBOL$1
@@ -474,10 +472,10 @@ var store$2 = sharedStore;
474
472
  (shared$3.exports = function (key, value) {
475
473
  return store$2[key] || (store$2[key] = value !== undefined ? value : {});
476
474
  })('versions', []).push({
477
- version: '3.31.1',
475
+ version: '3.32.1',
478
476
  mode: 'global',
479
477
  copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
480
- license: 'https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE',
478
+ license: 'https://github.com/zloirock/core-js/blob/v3.32.1/LICENSE',
481
479
  source: 'https://github.com/zloirock/core-js'
482
480
  });
483
481
 
@@ -590,7 +588,7 @@ var ie8DomDefine = !DESCRIPTORS$8 && !fails$a(function () {
590
588
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
591
589
  return Object.defineProperty(createElement('div'), 'a', {
592
590
  get: function () { return 7; }
593
- }).a != 7;
591
+ }).a !== 7;
594
592
  });
595
593
 
596
594
  var DESCRIPTORS$7 = descriptors;
@@ -628,7 +626,7 @@ var v8PrototypeDefineBug = DESCRIPTORS$6 && fails$9(function () {
628
626
  return Object.defineProperty(function () { /* empty */ }, 'prototype', {
629
627
  value: 42,
630
628
  writable: false
631
- }).prototype != 42;
629
+ }).prototype !== 42;
632
630
  });
633
631
 
634
632
  var isObject$3 = isObject$7;
@@ -973,10 +971,10 @@ var createMethod$1 = function (IS_INCLUDES) {
973
971
  var value;
974
972
  // Array#includes uses SameValueZero equality algorithm
975
973
  // eslint-disable-next-line no-self-compare -- NaN check
976
- if (IS_INCLUDES && el != el) while (length > index) {
974
+ if (IS_INCLUDES && el !== el) while (length > index) {
977
975
  value = O[index++];
978
976
  // eslint-disable-next-line no-self-compare -- NaN check
979
- if (value != value) return true;
977
+ if (value !== value) return true;
980
978
  // Array#indexOf ignores holes, Array#includes - not
981
979
  } else for (;length > index; index++) {
982
980
  if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
@@ -1081,8 +1079,8 @@ var replacement = /#|\.prototype\./;
1081
1079
 
1082
1080
  var isForced$1 = function (feature, detection) {
1083
1081
  var value = data[normalize(feature)];
1084
- return value == POLYFILL ? true
1085
- : value == NATIVE ? false
1082
+ return value === POLYFILL ? true
1083
+ : value === NATIVE ? false
1086
1084
  : isCallable$2(detection) ? fails$7(detection)
1087
1085
  : !!detection;
1088
1086
  };
@@ -1158,7 +1156,7 @@ var classof$5 = classofRaw$2;
1158
1156
  // https://tc39.es/ecma262/#sec-isarray
1159
1157
  // eslint-disable-next-line es/no-array-isarray -- safe
1160
1158
  var isArray$1 = Array.isArray || function isArray(argument) {
1161
- return classof$5(argument) == 'Array';
1159
+ return classof$5(argument) === 'Array';
1162
1160
  };
1163
1161
 
1164
1162
  var wellKnownSymbol$9 = wellKnownSymbol$b;
@@ -1179,7 +1177,7 @@ var TO_STRING_TAG = wellKnownSymbol$8('toStringTag');
1179
1177
  var $Object = Object;
1180
1178
 
1181
1179
  // ES3 wrong here
1182
- var CORRECT_ARGUMENTS = classofRaw$1(function () { return arguments; }()) == 'Arguments';
1180
+ var CORRECT_ARGUMENTS = classofRaw$1(function () { return arguments; }()) === 'Arguments';
1183
1181
 
1184
1182
  // fallback for IE11 Script Access Denied error
1185
1183
  var tryGet = function (it, key) {
@@ -1197,7 +1195,7 @@ var classof$4 = TO_STRING_TAG_SUPPORT ? classofRaw$1 : function (it) {
1197
1195
  // builtinTag case
1198
1196
  : CORRECT_ARGUMENTS ? classofRaw$1(O)
1199
1197
  // ES3 arguments fallback
1200
- : (result = classofRaw$1(O)) == 'Object' && isCallable$1(O.callee) ? 'Arguments' : result;
1198
+ : (result = classofRaw$1(O)) === 'Object' && isCallable$1(O.callee) ? 'Arguments' : result;
1201
1199
  };
1202
1200
 
1203
1201
  var uncurryThis$8 = functionUncurryThis;
@@ -1690,6 +1688,12 @@ function gematriya(number) {
1690
1688
  */
1691
1689
  function gematriyaStrToNum(str) {
1692
1690
  var num = 0;
1691
+ var gereshIdx = str.indexOf(GERESH);
1692
+ if (gereshIdx !== -1 && gereshIdx !== str.length - 1) {
1693
+ var thousands = str.substring(0, gereshIdx);
1694
+ num += gematriyaStrToNum(thousands) * 1000;
1695
+ str = str.substring(gereshIdx);
1696
+ }
1693
1697
  for (var i = 0; i < str.length; i++) {
1694
1698
  var n = heb2num[str[i]];
1695
1699
  if (typeof n === 'number') {
@@ -1728,7 +1732,8 @@ var arraySliceSimple = function (O, start, end) {
1728
1732
  var k = toAbsoluteIndex$1(start, length);
1729
1733
  var fin = toAbsoluteIndex$1(end === undefined ? length : end, length);
1730
1734
  var result = $Array$1(max(fin - k, 0));
1731
- for (var n = 0; k < fin; k++, n++) createProperty$1(result, n, O[k]);
1735
+ var n = 0;
1736
+ for (; k < fin; k++, n++) createProperty$1(result, n, O[k]);
1732
1737
  result.length = n;
1733
1738
  return result;
1734
1739
  };
@@ -3220,6 +3225,7 @@ var HDate = /*#__PURE__*/function () {
3220
3225
  return monthName;
3221
3226
  }
3222
3227
  var c = Locale.hebrewStripNikkud(monthName).trim().toLowerCase();
3228
+ // If Hebrew month starts with a bet (for example `בתמוז`) then ignore it
3223
3229
  if (c[0] === 'ב') {
3224
3230
  c = c.substring(1);
3225
3231
  }
@@ -3351,6 +3357,30 @@ var HDate = /*#__PURE__*/function () {
3351
3357
  value: function isHDate(obj) {
3352
3358
  return obj !== null && _typeof(obj) === 'object' && typeof obj.year === 'number' && typeof obj.month === 'number' && typeof obj.day === 'number' && typeof obj.greg === 'function' && typeof obj.abs === 'function';
3353
3359
  }
3360
+
3361
+ /**
3362
+ * Construct a new instance of `HDate` from a Gematriya-formatted string
3363
+ * @example
3364
+ * HDate.fromGematriyaString('כ״ז בְּתַמּוּז תשפ״ג') // 27 Tamuz 5783
3365
+ * HDate.fromGematriyaString('כ׳ סיון תש״ד') // 20 Sivan 5704
3366
+ * HDate.fromGematriyaString('ה׳ אִיָיר תש״ח') // 5 Iyyar 5708
3367
+ * @param {string} str
3368
+ * @param {number} currentThousands
3369
+ * @return {HDate}
3370
+ */
3371
+ }, {
3372
+ key: "fromGematriyaString",
3373
+ value: function fromGematriyaString(str) {
3374
+ var currentThousands = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5000;
3375
+ var parts = str.split(' ');
3376
+ var day = gematriyaStrToNum(parts[0]);
3377
+ var month = HDate.monthFromName(parts[1]);
3378
+ var year = gematriyaStrToNum(parts[2]);
3379
+ if (year < 1000) {
3380
+ year += currentThousands;
3381
+ }
3382
+ return new HDate(day, month, year);
3383
+ }
3354
3384
  }]);
3355
3385
  return HDate;
3356
3386
  }();
@@ -5354,7 +5384,7 @@ var $fromCodePoint = String.fromCodePoint;
5354
5384
  var join = uncurryThis$4([].join);
5355
5385
 
5356
5386
  // length should be 1, old FF problem
5357
- var INCORRECT_LENGTH = !!$fromCodePoint && $fromCodePoint.length != 1;
5387
+ var INCORRECT_LENGTH = !!$fromCodePoint && $fromCodePoint.length !== 1;
5358
5388
 
5359
5389
  // `String.fromCodePoint` method
5360
5390
  // https://tc39.es/ecma262/#sec-string.fromcodepoint
@@ -7552,9 +7582,9 @@ function getBirthdayOrAnniversary_(hyear, gdate) {
7552
7582
  return new HDate(day, month, hyear);
7553
7583
  }
7554
7584
 
7555
- var version="4.2.0";
7585
+ var version="4.3.1";
7556
7586
 
7557
- var headers$1={"plural-forms":"nplurals=2; plural=(n > 1);"};var 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"],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"],"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};
7587
+ var headers$1={"plural-forms":"nplurals=2; plural=(n > 1);"};var 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};
7558
7588
 
7559
7589
  Locale.addLocale('ashkenazi', poAshkenazi);
7560
7590
  Locale.addLocale('a', poAshkenazi);
@@ -7586,7 +7616,7 @@ var MATCH$1 = wellKnownSymbol$2('match');
7586
7616
  // https://tc39.es/ecma262/#sec-isregexp
7587
7617
  var isRegexp = function (it) {
7588
7618
  var isRegExp;
7589
- return isObject(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');
7619
+ return isObject(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof(it) === 'RegExp');
7590
7620
  };
7591
7621
 
7592
7622
  var isRegExp = isRegexp;
@@ -7688,7 +7718,6 @@ var getBuiltIn = getBuiltIn$4;
7688
7718
  var html$1 = getBuiltIn('document', 'documentElement');
7689
7719
 
7690
7720
  /* global ActiveXObject -- old IE, WSH */
7691
-
7692
7721
  var anObject = anObject$8;
7693
7722
  var definePropertiesModule = objectDefineProperties;
7694
7723
  var enumBugKeys = enumBugKeys$3;
@@ -7781,7 +7810,7 @@ var ArrayPrototype = Array.prototype;
7781
7810
 
7782
7811
  // Array.prototype[@@unscopables]
7783
7812
  // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
7784
- if (ArrayPrototype[UNSCOPABLES] == undefined) {
7813
+ if (ArrayPrototype[UNSCOPABLES] === undefined) {
7785
7814
  defineProperty(ArrayPrototype, UNSCOPABLES, {
7786
7815
  configurable: true,
7787
7816
  value: create(null)