@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 +0 -7
- package/dist/bundle.js +21 -42
- package/dist/bundle.min.js +2 -2
- package/dist/index.cjs +21 -56
- package/dist/index.mjs +21 -56
- package/hebcal.d.ts +1 -6
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v5.0.
|
|
1
|
+
/*! @hebcal/core v5.0.4 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
/** @private */
|
|
@@ -30,26 +30,6 @@ const ABS_2SEP1752 = 639785;
|
|
|
30
30
|
*/
|
|
31
31
|
exports.greg = void 0;
|
|
32
32
|
(function (greg) {
|
|
33
|
-
/**
|
|
34
|
-
* Long names of the Gregorian months (1='January', 12='December')
|
|
35
|
-
* @readonly
|
|
36
|
-
* @type {string[]}
|
|
37
|
-
*/
|
|
38
|
-
greg.monthNames = [
|
|
39
|
-
'',
|
|
40
|
-
'January',
|
|
41
|
-
'February',
|
|
42
|
-
'March',
|
|
43
|
-
'April',
|
|
44
|
-
'May',
|
|
45
|
-
'June',
|
|
46
|
-
'July',
|
|
47
|
-
'August',
|
|
48
|
-
'September',
|
|
49
|
-
'October',
|
|
50
|
-
'November',
|
|
51
|
-
'December',
|
|
52
|
-
];
|
|
53
33
|
/**
|
|
54
34
|
* Returns true if the Gregorian year is a leap year
|
|
55
35
|
* @param {number} year Gregorian year
|
|
@@ -4620,7 +4600,6 @@ class Sedra {
|
|
|
4620
4600
|
}
|
|
4621
4601
|
|
|
4622
4602
|
/**
|
|
4623
|
-
* @private
|
|
4624
4603
|
* @return {Object[]}
|
|
4625
4604
|
*/
|
|
4626
4605
|
getSedraArray() {
|
|
@@ -4653,7 +4632,7 @@ class Sedra {
|
|
|
4653
4632
|
const weekNum = (saturday - this.firstSaturday) / 7;
|
|
4654
4633
|
const index = this.theSedraArray[weekNum];
|
|
4655
4634
|
if (typeof index === 'undefined') {
|
|
4656
|
-
const sedra =
|
|
4635
|
+
const sedra = getSedra_(this.year + 1, this.il);
|
|
4657
4636
|
return sedra.lookup(saturday); // must be next year
|
|
4658
4637
|
}
|
|
4659
4638
|
if (typeof index === 'string') {
|
|
@@ -4843,6 +4822,23 @@ types['1311'] = types['1221'];
|
|
|
4843
4822
|
/* Hebrew year that starts on Saturday, is `complete' (Heshvan and
|
|
4844
4823
|
* Kislev each have 30 days), and has Passover start on Thursday. */
|
|
4845
4824
|
types['1721'] = types['170'];
|
|
4825
|
+
const sedraCache = new Map();
|
|
4826
|
+
|
|
4827
|
+
/**
|
|
4828
|
+
* @private
|
|
4829
|
+
* @param {number} hyear
|
|
4830
|
+
* @param {boolean} il
|
|
4831
|
+
* @return {Sedra}
|
|
4832
|
+
*/
|
|
4833
|
+
function getSedra_(hyear, il) {
|
|
4834
|
+
const cacheKey = `${hyear}-${il ? 1 : 0}`;
|
|
4835
|
+
let sedra = sedraCache.get(cacheKey);
|
|
4836
|
+
if (!sedra) {
|
|
4837
|
+
sedra = new Sedra(hyear, il);
|
|
4838
|
+
sedraCache.set(cacheKey, sedra);
|
|
4839
|
+
}
|
|
4840
|
+
return sedra;
|
|
4841
|
+
}
|
|
4846
4842
|
|
|
4847
4843
|
/**
|
|
4848
4844
|
* Represents one of 54 weekly Torah portions, always on a Saturday
|
|
@@ -5610,23 +5606,6 @@ const KISLEV = months.KISLEV;
|
|
|
5610
5606
|
const TEVET = months.TEVET;
|
|
5611
5607
|
const ADAR_I = months.ADAR_I;
|
|
5612
5608
|
const ADAR_II = months.ADAR_II;
|
|
5613
|
-
const sedraCache = new Map();
|
|
5614
|
-
|
|
5615
|
-
/**
|
|
5616
|
-
* @private
|
|
5617
|
-
* @param {number} hyear
|
|
5618
|
-
* @param {boolean} il
|
|
5619
|
-
* @return {Sedra}
|
|
5620
|
-
*/
|
|
5621
|
-
function getSedra_(hyear, il) {
|
|
5622
|
-
const cacheKey = `${hyear}-${il ? 1 : 0}`;
|
|
5623
|
-
let sedra = sedraCache.get(cacheKey);
|
|
5624
|
-
if (!sedra) {
|
|
5625
|
-
sedra = new Sedra(hyear, il);
|
|
5626
|
-
sedraCache.set(cacheKey, sedra);
|
|
5627
|
-
}
|
|
5628
|
-
return sedra;
|
|
5629
|
-
}
|
|
5630
5609
|
const emojiIsraelFlag = {
|
|
5631
5610
|
emoji: '🇮🇱'
|
|
5632
5611
|
};
|
|
@@ -5887,7 +5866,7 @@ class DailyLearning {
|
|
|
5887
5866
|
}
|
|
5888
5867
|
|
|
5889
5868
|
// DO NOT EDIT THIS AUTO-GENERATED FILE!
|
|
5890
|
-
const version = '5.0.
|
|
5869
|
+
const version = '5.0.4';
|
|
5891
5870
|
|
|
5892
5871
|
const NONE$1 = 0;
|
|
5893
5872
|
const HALF = 1;
|
|
@@ -6913,8 +6892,6 @@ function observedInIsrael(ev) {
|
|
|
6913
6892
|
function observedInDiaspora(ev) {
|
|
6914
6893
|
return ev.observedInDiaspora();
|
|
6915
6894
|
}
|
|
6916
|
-
const yearArrayCache = new Map();
|
|
6917
|
-
const holidaysOnDate = new Map();
|
|
6918
6895
|
|
|
6919
6896
|
/**
|
|
6920
6897
|
* HebrewCalendar is the main interface to the `@hebcal/core` library.
|
|
@@ -7239,15 +7216,10 @@ class HebrewCalendar {
|
|
|
7239
7216
|
* @return {Event[]}
|
|
7240
7217
|
*/
|
|
7241
7218
|
static getHolidaysForYearArray(year, il) {
|
|
7242
|
-
const cacheKey = `${year}-${il ? 1 : 0}`;
|
|
7243
|
-
let events = yearArrayCache.get(cacheKey);
|
|
7244
|
-
if (events) {
|
|
7245
|
-
return events;
|
|
7246
|
-
}
|
|
7247
7219
|
const yearMap = getHolidaysForYear_(year);
|
|
7248
7220
|
const startAbs = HDate.hebrew2abs(year, TISHREI, 1);
|
|
7249
7221
|
const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
|
|
7250
|
-
events = [];
|
|
7222
|
+
let events = [];
|
|
7251
7223
|
const myFilter = il ? observedInIsrael : observedInDiaspora;
|
|
7252
7224
|
for (let absDt = startAbs; absDt <= endAbs; absDt++) {
|
|
7253
7225
|
const hd = new HDate(absDt);
|
|
@@ -7257,7 +7229,6 @@ class HebrewCalendar {
|
|
|
7257
7229
|
events = events.concat(filtered);
|
|
7258
7230
|
}
|
|
7259
7231
|
}
|
|
7260
|
-
yearArrayCache.set(cacheKey, events);
|
|
7261
7232
|
return events;
|
|
7262
7233
|
}
|
|
7263
7234
|
|
|
@@ -7270,20 +7241,14 @@ class HebrewCalendar {
|
|
|
7270
7241
|
static getHolidaysOnDate(date, il) {
|
|
7271
7242
|
const hd = HDate.isHDate(date) ? date : new HDate(date);
|
|
7272
7243
|
const hdStr = hd.toString();
|
|
7273
|
-
const cacheKey = hdStr + '/' + (typeof il === 'undefined' ? 2 : il ? 1 : 0);
|
|
7274
|
-
if (holidaysOnDate.has(cacheKey)) {
|
|
7275
|
-
return holidaysOnDate.get(cacheKey);
|
|
7276
|
-
}
|
|
7277
7244
|
const yearMap = getHolidaysForYear_(hd.getFullYear());
|
|
7278
7245
|
const events = yearMap.get(hdStr);
|
|
7279
7246
|
// if il isn't a boolean return both diaspora + IL for day
|
|
7280
7247
|
if (typeof il === 'undefined' || typeof events === 'undefined') {
|
|
7281
|
-
holidaysOnDate.set(cacheKey, events);
|
|
7282
7248
|
return events;
|
|
7283
7249
|
}
|
|
7284
7250
|
const myFilter = il ? observedInIsrael : observedInDiaspora;
|
|
7285
7251
|
const filtered = events.filter(myFilter);
|
|
7286
|
-
holidaysOnDate.set(cacheKey, filtered);
|
|
7287
7252
|
return filtered;
|
|
7288
7253
|
}
|
|
7289
7254
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v5.0.
|
|
1
|
+
/*! @hebcal/core v5.0.4 */
|
|
2
2
|
/** @private */
|
|
3
3
|
const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
4
4
|
/** @private */
|
|
@@ -28,26 +28,6 @@ const ABS_2SEP1752 = 639785;
|
|
|
28
28
|
*/
|
|
29
29
|
var greg;
|
|
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 = [
|
|
37
|
-
'',
|
|
38
|
-
'January',
|
|
39
|
-
'February',
|
|
40
|
-
'March',
|
|
41
|
-
'April',
|
|
42
|
-
'May',
|
|
43
|
-
'June',
|
|
44
|
-
'July',
|
|
45
|
-
'August',
|
|
46
|
-
'September',
|
|
47
|
-
'October',
|
|
48
|
-
'November',
|
|
49
|
-
'December',
|
|
50
|
-
];
|
|
51
31
|
/**
|
|
52
32
|
* Returns true if the Gregorian year is a leap year
|
|
53
33
|
* @param {number} year Gregorian year
|
|
@@ -4618,7 +4598,6 @@ class Sedra {
|
|
|
4618
4598
|
}
|
|
4619
4599
|
|
|
4620
4600
|
/**
|
|
4621
|
-
* @private
|
|
4622
4601
|
* @return {Object[]}
|
|
4623
4602
|
*/
|
|
4624
4603
|
getSedraArray() {
|
|
@@ -4651,7 +4630,7 @@ class Sedra {
|
|
|
4651
4630
|
const weekNum = (saturday - this.firstSaturday) / 7;
|
|
4652
4631
|
const index = this.theSedraArray[weekNum];
|
|
4653
4632
|
if (typeof index === 'undefined') {
|
|
4654
|
-
const sedra =
|
|
4633
|
+
const sedra = getSedra_(this.year + 1, this.il);
|
|
4655
4634
|
return sedra.lookup(saturday); // must be next year
|
|
4656
4635
|
}
|
|
4657
4636
|
if (typeof index === 'string') {
|
|
@@ -4841,6 +4820,23 @@ types['1311'] = types['1221'];
|
|
|
4841
4820
|
/* Hebrew year that starts on Saturday, is `complete' (Heshvan and
|
|
4842
4821
|
* Kislev each have 30 days), and has Passover start on Thursday. */
|
|
4843
4822
|
types['1721'] = types['170'];
|
|
4823
|
+
const sedraCache = new Map();
|
|
4824
|
+
|
|
4825
|
+
/**
|
|
4826
|
+
* @private
|
|
4827
|
+
* @param {number} hyear
|
|
4828
|
+
* @param {boolean} il
|
|
4829
|
+
* @return {Sedra}
|
|
4830
|
+
*/
|
|
4831
|
+
function getSedra_(hyear, il) {
|
|
4832
|
+
const cacheKey = `${hyear}-${il ? 1 : 0}`;
|
|
4833
|
+
let sedra = sedraCache.get(cacheKey);
|
|
4834
|
+
if (!sedra) {
|
|
4835
|
+
sedra = new Sedra(hyear, il);
|
|
4836
|
+
sedraCache.set(cacheKey, sedra);
|
|
4837
|
+
}
|
|
4838
|
+
return sedra;
|
|
4839
|
+
}
|
|
4844
4840
|
|
|
4845
4841
|
/**
|
|
4846
4842
|
* Represents one of 54 weekly Torah portions, always on a Saturday
|
|
@@ -5608,23 +5604,6 @@ const KISLEV = months.KISLEV;
|
|
|
5608
5604
|
const TEVET = months.TEVET;
|
|
5609
5605
|
const ADAR_I = months.ADAR_I;
|
|
5610
5606
|
const ADAR_II = months.ADAR_II;
|
|
5611
|
-
const sedraCache = new Map();
|
|
5612
|
-
|
|
5613
|
-
/**
|
|
5614
|
-
* @private
|
|
5615
|
-
* @param {number} hyear
|
|
5616
|
-
* @param {boolean} il
|
|
5617
|
-
* @return {Sedra}
|
|
5618
|
-
*/
|
|
5619
|
-
function getSedra_(hyear, il) {
|
|
5620
|
-
const cacheKey = `${hyear}-${il ? 1 : 0}`;
|
|
5621
|
-
let sedra = sedraCache.get(cacheKey);
|
|
5622
|
-
if (!sedra) {
|
|
5623
|
-
sedra = new Sedra(hyear, il);
|
|
5624
|
-
sedraCache.set(cacheKey, sedra);
|
|
5625
|
-
}
|
|
5626
|
-
return sedra;
|
|
5627
|
-
}
|
|
5628
5607
|
const emojiIsraelFlag = {
|
|
5629
5608
|
emoji: '🇮🇱'
|
|
5630
5609
|
};
|
|
@@ -5885,7 +5864,7 @@ class DailyLearning {
|
|
|
5885
5864
|
}
|
|
5886
5865
|
|
|
5887
5866
|
// DO NOT EDIT THIS AUTO-GENERATED FILE!
|
|
5888
|
-
const version = '5.0.
|
|
5867
|
+
const version = '5.0.4';
|
|
5889
5868
|
|
|
5890
5869
|
const NONE$1 = 0;
|
|
5891
5870
|
const HALF = 1;
|
|
@@ -6911,8 +6890,6 @@ function observedInIsrael(ev) {
|
|
|
6911
6890
|
function observedInDiaspora(ev) {
|
|
6912
6891
|
return ev.observedInDiaspora();
|
|
6913
6892
|
}
|
|
6914
|
-
const yearArrayCache = new Map();
|
|
6915
|
-
const holidaysOnDate = new Map();
|
|
6916
6893
|
|
|
6917
6894
|
/**
|
|
6918
6895
|
* HebrewCalendar is the main interface to the `@hebcal/core` library.
|
|
@@ -7237,15 +7214,10 @@ class HebrewCalendar {
|
|
|
7237
7214
|
* @return {Event[]}
|
|
7238
7215
|
*/
|
|
7239
7216
|
static getHolidaysForYearArray(year, il) {
|
|
7240
|
-
const cacheKey = `${year}-${il ? 1 : 0}`;
|
|
7241
|
-
let events = yearArrayCache.get(cacheKey);
|
|
7242
|
-
if (events) {
|
|
7243
|
-
return events;
|
|
7244
|
-
}
|
|
7245
7217
|
const yearMap = getHolidaysForYear_(year);
|
|
7246
7218
|
const startAbs = HDate.hebrew2abs(year, TISHREI, 1);
|
|
7247
7219
|
const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
|
|
7248
|
-
events = [];
|
|
7220
|
+
let events = [];
|
|
7249
7221
|
const myFilter = il ? observedInIsrael : observedInDiaspora;
|
|
7250
7222
|
for (let absDt = startAbs; absDt <= endAbs; absDt++) {
|
|
7251
7223
|
const hd = new HDate(absDt);
|
|
@@ -7255,7 +7227,6 @@ class HebrewCalendar {
|
|
|
7255
7227
|
events = events.concat(filtered);
|
|
7256
7228
|
}
|
|
7257
7229
|
}
|
|
7258
|
-
yearArrayCache.set(cacheKey, events);
|
|
7259
7230
|
return events;
|
|
7260
7231
|
}
|
|
7261
7232
|
|
|
@@ -7268,20 +7239,14 @@ class HebrewCalendar {
|
|
|
7268
7239
|
static getHolidaysOnDate(date, il) {
|
|
7269
7240
|
const hd = HDate.isHDate(date) ? date : new HDate(date);
|
|
7270
7241
|
const hdStr = hd.toString();
|
|
7271
|
-
const cacheKey = hdStr + '/' + (typeof il === 'undefined' ? 2 : il ? 1 : 0);
|
|
7272
|
-
if (holidaysOnDate.has(cacheKey)) {
|
|
7273
|
-
return holidaysOnDate.get(cacheKey);
|
|
7274
|
-
}
|
|
7275
7242
|
const yearMap = getHolidaysForYear_(hd.getFullYear());
|
|
7276
7243
|
const events = yearMap.get(hdStr);
|
|
7277
7244
|
// if il isn't a boolean return both diaspora + IL for day
|
|
7278
7245
|
if (typeof il === 'undefined' || typeof events === 'undefined') {
|
|
7279
|
-
holidaysOnDate.set(cacheKey, events);
|
|
7280
7246
|
return events;
|
|
7281
7247
|
}
|
|
7282
7248
|
const myFilter = il ? observedInIsrael : observedInDiaspora;
|
|
7283
7249
|
const filtered = events.filter(myFilter);
|
|
7284
|
-
holidaysOnDate.set(cacheKey, filtered);
|
|
7285
7250
|
return filtered;
|
|
7286
7251
|
}
|
|
7287
7252
|
|
package/hebcal.d.ts
CHANGED
|
@@ -820,12 +820,6 @@ declare module '@hebcal/core' {
|
|
|
820
820
|
* Gregorian date helper functions.
|
|
821
821
|
*/
|
|
822
822
|
export namespace greg {
|
|
823
|
-
/**
|
|
824
|
-
* Long names of the Gregorian months (1='January', 12='December')
|
|
825
|
-
* @readonly
|
|
826
|
-
* @type {string[]}
|
|
827
|
-
*/
|
|
828
|
-
const monthNames: string[];
|
|
829
823
|
/**
|
|
830
824
|
* Returns true if the Gregorian year is a leap year
|
|
831
825
|
* @param {number} year Gregorian year
|
|
@@ -983,6 +977,7 @@ declare module '@hebcal/core' {
|
|
|
983
977
|
*/
|
|
984
978
|
find(parsha: number | string | string[]): HDate;
|
|
985
979
|
getYear(): number;
|
|
980
|
+
getSedraArray(): any[];
|
|
986
981
|
/**
|
|
987
982
|
* R.D. date of the first Saturday on or after Rosh Hashana
|
|
988
983
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/core",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.4",
|
|
4
4
|
"author": "Michael J. Radwin (https://github.com/mjradwin)",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Eyal Schachter (https://github.com/Scimonster)",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@babel/core": "^7.23.6",
|
|
74
74
|
"@babel/preset-env": "^7.23.6",
|
|
75
75
|
"@babel/register": "^7.22.15",
|
|
76
|
-
"@hebcal/hdate": "^0.9.
|
|
76
|
+
"@hebcal/hdate": "^0.9.1",
|
|
77
77
|
"@hebcal/noaa": "^0.8.11",
|
|
78
78
|
"@rollup/plugin-babel": "^6.0.4",
|
|
79
79
|
"@rollup/plugin-commonjs": "^25.0.7",
|