@hebcal/core 5.0.3 → 5.0.5
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 +278 -50
- package/dist/bundle.min.js +2 -2
- package/dist/index.cjs +321 -64
- package/dist/index.mjs +321 -64
- package/hebcal.d.ts +1 -6
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v5.0.
|
|
1
|
+
/*! @hebcal/core v5.0.5 */
|
|
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
|
|
@@ -4454,6 +4434,300 @@ function getTodayIsHe(omer) {
|
|
|
4454
4434
|
return str.normalize();
|
|
4455
4435
|
}
|
|
4456
4436
|
|
|
4437
|
+
class QuickLRU extends Map {
|
|
4438
|
+
#size = 0;
|
|
4439
|
+
#cache = new Map();
|
|
4440
|
+
#oldCache = new Map();
|
|
4441
|
+
#maxSize;
|
|
4442
|
+
#maxAge;
|
|
4443
|
+
#onEviction;
|
|
4444
|
+
|
|
4445
|
+
constructor(options = {}) {
|
|
4446
|
+
super();
|
|
4447
|
+
|
|
4448
|
+
if (!(options.maxSize && options.maxSize > 0)) {
|
|
4449
|
+
throw new TypeError('`maxSize` must be a number greater than 0');
|
|
4450
|
+
}
|
|
4451
|
+
|
|
4452
|
+
if (typeof options.maxAge === 'number' && options.maxAge === 0) {
|
|
4453
|
+
throw new TypeError('`maxAge` must be a number greater than 0');
|
|
4454
|
+
}
|
|
4455
|
+
|
|
4456
|
+
this.#maxSize = options.maxSize;
|
|
4457
|
+
this.#maxAge = options.maxAge || Number.POSITIVE_INFINITY;
|
|
4458
|
+
this.#onEviction = options.onEviction;
|
|
4459
|
+
}
|
|
4460
|
+
|
|
4461
|
+
// For tests.
|
|
4462
|
+
get __oldCache() {
|
|
4463
|
+
return this.#oldCache;
|
|
4464
|
+
}
|
|
4465
|
+
|
|
4466
|
+
#emitEvictions(cache) {
|
|
4467
|
+
if (typeof this.#onEviction !== 'function') {
|
|
4468
|
+
return;
|
|
4469
|
+
}
|
|
4470
|
+
|
|
4471
|
+
for (const [key, item] of cache) {
|
|
4472
|
+
this.#onEviction(key, item.value);
|
|
4473
|
+
}
|
|
4474
|
+
}
|
|
4475
|
+
|
|
4476
|
+
#deleteIfExpired(key, item) {
|
|
4477
|
+
if (typeof item.expiry === 'number' && item.expiry <= Date.now()) {
|
|
4478
|
+
if (typeof this.#onEviction === 'function') {
|
|
4479
|
+
this.#onEviction(key, item.value);
|
|
4480
|
+
}
|
|
4481
|
+
|
|
4482
|
+
return this.delete(key);
|
|
4483
|
+
}
|
|
4484
|
+
|
|
4485
|
+
return false;
|
|
4486
|
+
}
|
|
4487
|
+
|
|
4488
|
+
#getOrDeleteIfExpired(key, item) {
|
|
4489
|
+
const deleted = this.#deleteIfExpired(key, item);
|
|
4490
|
+
if (deleted === false) {
|
|
4491
|
+
return item.value;
|
|
4492
|
+
}
|
|
4493
|
+
}
|
|
4494
|
+
|
|
4495
|
+
#getItemValue(key, item) {
|
|
4496
|
+
return item.expiry ? this.#getOrDeleteIfExpired(key, item) : item.value;
|
|
4497
|
+
}
|
|
4498
|
+
|
|
4499
|
+
#peek(key, cache) {
|
|
4500
|
+
const item = cache.get(key);
|
|
4501
|
+
|
|
4502
|
+
return this.#getItemValue(key, item);
|
|
4503
|
+
}
|
|
4504
|
+
|
|
4505
|
+
#set(key, value) {
|
|
4506
|
+
this.#cache.set(key, value);
|
|
4507
|
+
this.#size++;
|
|
4508
|
+
|
|
4509
|
+
if (this.#size >= this.#maxSize) {
|
|
4510
|
+
this.#size = 0;
|
|
4511
|
+
this.#emitEvictions(this.#oldCache);
|
|
4512
|
+
this.#oldCache = this.#cache;
|
|
4513
|
+
this.#cache = new Map();
|
|
4514
|
+
}
|
|
4515
|
+
}
|
|
4516
|
+
|
|
4517
|
+
#moveToRecent(key, item) {
|
|
4518
|
+
this.#oldCache.delete(key);
|
|
4519
|
+
this.#set(key, item);
|
|
4520
|
+
}
|
|
4521
|
+
|
|
4522
|
+
* #entriesAscending() {
|
|
4523
|
+
for (const item of this.#oldCache) {
|
|
4524
|
+
const [key, value] = item;
|
|
4525
|
+
if (!this.#cache.has(key)) {
|
|
4526
|
+
const deleted = this.#deleteIfExpired(key, value);
|
|
4527
|
+
if (deleted === false) {
|
|
4528
|
+
yield item;
|
|
4529
|
+
}
|
|
4530
|
+
}
|
|
4531
|
+
}
|
|
4532
|
+
|
|
4533
|
+
for (const item of this.#cache) {
|
|
4534
|
+
const [key, value] = item;
|
|
4535
|
+
const deleted = this.#deleteIfExpired(key, value);
|
|
4536
|
+
if (deleted === false) {
|
|
4537
|
+
yield item;
|
|
4538
|
+
}
|
|
4539
|
+
}
|
|
4540
|
+
}
|
|
4541
|
+
|
|
4542
|
+
get(key) {
|
|
4543
|
+
if (this.#cache.has(key)) {
|
|
4544
|
+
const item = this.#cache.get(key);
|
|
4545
|
+
return this.#getItemValue(key, item);
|
|
4546
|
+
}
|
|
4547
|
+
|
|
4548
|
+
if (this.#oldCache.has(key)) {
|
|
4549
|
+
const item = this.#oldCache.get(key);
|
|
4550
|
+
if (this.#deleteIfExpired(key, item) === false) {
|
|
4551
|
+
this.#moveToRecent(key, item);
|
|
4552
|
+
return item.value;
|
|
4553
|
+
}
|
|
4554
|
+
}
|
|
4555
|
+
}
|
|
4556
|
+
|
|
4557
|
+
set(key, value, {maxAge = this.#maxAge} = {}) {
|
|
4558
|
+
const expiry = typeof maxAge === 'number' && maxAge !== Number.POSITIVE_INFINITY
|
|
4559
|
+
? (Date.now() + maxAge)
|
|
4560
|
+
: undefined;
|
|
4561
|
+
|
|
4562
|
+
if (this.#cache.has(key)) {
|
|
4563
|
+
this.#cache.set(key, {
|
|
4564
|
+
value,
|
|
4565
|
+
expiry,
|
|
4566
|
+
});
|
|
4567
|
+
} else {
|
|
4568
|
+
this.#set(key, {value, expiry});
|
|
4569
|
+
}
|
|
4570
|
+
|
|
4571
|
+
return this;
|
|
4572
|
+
}
|
|
4573
|
+
|
|
4574
|
+
has(key) {
|
|
4575
|
+
if (this.#cache.has(key)) {
|
|
4576
|
+
return !this.#deleteIfExpired(key, this.#cache.get(key));
|
|
4577
|
+
}
|
|
4578
|
+
|
|
4579
|
+
if (this.#oldCache.has(key)) {
|
|
4580
|
+
return !this.#deleteIfExpired(key, this.#oldCache.get(key));
|
|
4581
|
+
}
|
|
4582
|
+
|
|
4583
|
+
return false;
|
|
4584
|
+
}
|
|
4585
|
+
|
|
4586
|
+
peek(key) {
|
|
4587
|
+
if (this.#cache.has(key)) {
|
|
4588
|
+
return this.#peek(key, this.#cache);
|
|
4589
|
+
}
|
|
4590
|
+
|
|
4591
|
+
if (this.#oldCache.has(key)) {
|
|
4592
|
+
return this.#peek(key, this.#oldCache);
|
|
4593
|
+
}
|
|
4594
|
+
}
|
|
4595
|
+
|
|
4596
|
+
delete(key) {
|
|
4597
|
+
const deleted = this.#cache.delete(key);
|
|
4598
|
+
if (deleted) {
|
|
4599
|
+
this.#size--;
|
|
4600
|
+
}
|
|
4601
|
+
|
|
4602
|
+
return this.#oldCache.delete(key) || deleted;
|
|
4603
|
+
}
|
|
4604
|
+
|
|
4605
|
+
clear() {
|
|
4606
|
+
this.#cache.clear();
|
|
4607
|
+
this.#oldCache.clear();
|
|
4608
|
+
this.#size = 0;
|
|
4609
|
+
}
|
|
4610
|
+
|
|
4611
|
+
resize(newSize) {
|
|
4612
|
+
if (!(newSize && newSize > 0)) {
|
|
4613
|
+
throw new TypeError('`maxSize` must be a number greater than 0');
|
|
4614
|
+
}
|
|
4615
|
+
|
|
4616
|
+
const items = [...this.#entriesAscending()];
|
|
4617
|
+
const removeCount = items.length - newSize;
|
|
4618
|
+
if (removeCount < 0) {
|
|
4619
|
+
this.#cache = new Map(items);
|
|
4620
|
+
this.#oldCache = new Map();
|
|
4621
|
+
this.#size = items.length;
|
|
4622
|
+
} else {
|
|
4623
|
+
if (removeCount > 0) {
|
|
4624
|
+
this.#emitEvictions(items.slice(0, removeCount));
|
|
4625
|
+
}
|
|
4626
|
+
|
|
4627
|
+
this.#oldCache = new Map(items.slice(removeCount));
|
|
4628
|
+
this.#cache = new Map();
|
|
4629
|
+
this.#size = 0;
|
|
4630
|
+
}
|
|
4631
|
+
|
|
4632
|
+
this.#maxSize = newSize;
|
|
4633
|
+
}
|
|
4634
|
+
|
|
4635
|
+
* keys() {
|
|
4636
|
+
for (const [key] of this) {
|
|
4637
|
+
yield key;
|
|
4638
|
+
}
|
|
4639
|
+
}
|
|
4640
|
+
|
|
4641
|
+
* values() {
|
|
4642
|
+
for (const [, value] of this) {
|
|
4643
|
+
yield value;
|
|
4644
|
+
}
|
|
4645
|
+
}
|
|
4646
|
+
|
|
4647
|
+
* [Symbol.iterator]() {
|
|
4648
|
+
for (const item of this.#cache) {
|
|
4649
|
+
const [key, value] = item;
|
|
4650
|
+
const deleted = this.#deleteIfExpired(key, value);
|
|
4651
|
+
if (deleted === false) {
|
|
4652
|
+
yield [key, value.value];
|
|
4653
|
+
}
|
|
4654
|
+
}
|
|
4655
|
+
|
|
4656
|
+
for (const item of this.#oldCache) {
|
|
4657
|
+
const [key, value] = item;
|
|
4658
|
+
if (!this.#cache.has(key)) {
|
|
4659
|
+
const deleted = this.#deleteIfExpired(key, value);
|
|
4660
|
+
if (deleted === false) {
|
|
4661
|
+
yield [key, value.value];
|
|
4662
|
+
}
|
|
4663
|
+
}
|
|
4664
|
+
}
|
|
4665
|
+
}
|
|
4666
|
+
|
|
4667
|
+
* entriesDescending() {
|
|
4668
|
+
let items = [...this.#cache];
|
|
4669
|
+
for (let i = items.length - 1; i >= 0; --i) {
|
|
4670
|
+
const item = items[i];
|
|
4671
|
+
const [key, value] = item;
|
|
4672
|
+
const deleted = this.#deleteIfExpired(key, value);
|
|
4673
|
+
if (deleted === false) {
|
|
4674
|
+
yield [key, value.value];
|
|
4675
|
+
}
|
|
4676
|
+
}
|
|
4677
|
+
|
|
4678
|
+
items = [...this.#oldCache];
|
|
4679
|
+
for (let i = items.length - 1; i >= 0; --i) {
|
|
4680
|
+
const item = items[i];
|
|
4681
|
+
const [key, value] = item;
|
|
4682
|
+
if (!this.#cache.has(key)) {
|
|
4683
|
+
const deleted = this.#deleteIfExpired(key, value);
|
|
4684
|
+
if (deleted === false) {
|
|
4685
|
+
yield [key, value.value];
|
|
4686
|
+
}
|
|
4687
|
+
}
|
|
4688
|
+
}
|
|
4689
|
+
}
|
|
4690
|
+
|
|
4691
|
+
* entriesAscending() {
|
|
4692
|
+
for (const [key, value] of this.#entriesAscending()) {
|
|
4693
|
+
yield [key, value.value];
|
|
4694
|
+
}
|
|
4695
|
+
}
|
|
4696
|
+
|
|
4697
|
+
get size() {
|
|
4698
|
+
if (!this.#size) {
|
|
4699
|
+
return this.#oldCache.size;
|
|
4700
|
+
}
|
|
4701
|
+
|
|
4702
|
+
let oldCacheSize = 0;
|
|
4703
|
+
for (const key of this.#oldCache.keys()) {
|
|
4704
|
+
if (!this.#cache.has(key)) {
|
|
4705
|
+
oldCacheSize++;
|
|
4706
|
+
}
|
|
4707
|
+
}
|
|
4708
|
+
|
|
4709
|
+
return Math.min(this.#size + oldCacheSize, this.#maxSize);
|
|
4710
|
+
}
|
|
4711
|
+
|
|
4712
|
+
get maxSize() {
|
|
4713
|
+
return this.#maxSize;
|
|
4714
|
+
}
|
|
4715
|
+
|
|
4716
|
+
entries() {
|
|
4717
|
+
return this.entriesAscending();
|
|
4718
|
+
}
|
|
4719
|
+
|
|
4720
|
+
forEach(callbackFunction, thisArgument = this) {
|
|
4721
|
+
for (const [key, value] of this.entriesAscending()) {
|
|
4722
|
+
callbackFunction.call(thisArgument, value, key, this);
|
|
4723
|
+
}
|
|
4724
|
+
}
|
|
4725
|
+
|
|
4726
|
+
get [Symbol.toStringTag]() {
|
|
4727
|
+
return JSON.stringify([...this.entriesAscending()]);
|
|
4728
|
+
}
|
|
4729
|
+
}
|
|
4730
|
+
|
|
4457
4731
|
/* eslint-disable new-cap */
|
|
4458
4732
|
/*
|
|
4459
4733
|
Hebcal - A Jewish Calendar Generator
|
|
@@ -4618,7 +4892,6 @@ class Sedra {
|
|
|
4618
4892
|
}
|
|
4619
4893
|
|
|
4620
4894
|
/**
|
|
4621
|
-
* @private
|
|
4622
4895
|
* @return {Object[]}
|
|
4623
4896
|
*/
|
|
4624
4897
|
getSedraArray() {
|
|
@@ -4651,7 +4924,7 @@ class Sedra {
|
|
|
4651
4924
|
const weekNum = (saturday - this.firstSaturday) / 7;
|
|
4652
4925
|
const index = this.theSedraArray[weekNum];
|
|
4653
4926
|
if (typeof index === 'undefined') {
|
|
4654
|
-
const sedra =
|
|
4927
|
+
const sedra = getSedra_(this.year + 1, this.il);
|
|
4655
4928
|
return sedra.lookup(saturday); // must be next year
|
|
4656
4929
|
}
|
|
4657
4930
|
if (typeof index === 'string') {
|
|
@@ -4841,6 +5114,25 @@ types['1311'] = types['1221'];
|
|
|
4841
5114
|
/* Hebrew year that starts on Saturday, is `complete' (Heshvan and
|
|
4842
5115
|
* Kislev each have 30 days), and has Passover start on Thursday. */
|
|
4843
5116
|
types['1721'] = types['170'];
|
|
5117
|
+
const sedraCache = new QuickLRU({
|
|
5118
|
+
maxSize: 400
|
|
5119
|
+
});
|
|
5120
|
+
|
|
5121
|
+
/**
|
|
5122
|
+
* @private
|
|
5123
|
+
* @param {number} hyear
|
|
5124
|
+
* @param {boolean} il
|
|
5125
|
+
* @return {Sedra}
|
|
5126
|
+
*/
|
|
5127
|
+
function getSedra_(hyear, il) {
|
|
5128
|
+
const cacheKey = `${hyear}-${il ? 1 : 0}`;
|
|
5129
|
+
let sedra = sedraCache.get(cacheKey);
|
|
5130
|
+
if (!sedra) {
|
|
5131
|
+
sedra = new Sedra(hyear, il);
|
|
5132
|
+
sedraCache.set(cacheKey, sedra);
|
|
5133
|
+
}
|
|
5134
|
+
return sedra;
|
|
5135
|
+
}
|
|
4844
5136
|
|
|
4845
5137
|
/**
|
|
4846
5138
|
* Represents one of 54 weekly Torah portions, always on a Saturday
|
|
@@ -5608,28 +5900,13 @@ const KISLEV = months.KISLEV;
|
|
|
5608
5900
|
const TEVET = months.TEVET;
|
|
5609
5901
|
const ADAR_I = months.ADAR_I;
|
|
5610
5902
|
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
5903
|
const emojiIsraelFlag = {
|
|
5629
5904
|
emoji: '🇮🇱'
|
|
5630
5905
|
};
|
|
5631
5906
|
const chanukahEmoji = '🕎';
|
|
5632
|
-
const yearCache = new
|
|
5907
|
+
const yearCache = new QuickLRU({
|
|
5908
|
+
maxSize: 400
|
|
5909
|
+
});
|
|
5633
5910
|
const KEYCAP_DIGITS = ['0️⃣', '1️⃣', '2️⃣', '3️⃣', '4️⃣', '5️⃣', '6️⃣', '7️⃣', '8️⃣', '9️⃣'];
|
|
5634
5911
|
|
|
5635
5912
|
/**
|
|
@@ -5885,7 +6162,7 @@ class DailyLearning {
|
|
|
5885
6162
|
}
|
|
5886
6163
|
|
|
5887
6164
|
// DO NOT EDIT THIS AUTO-GENERATED FILE!
|
|
5888
|
-
const version = '5.0.
|
|
6165
|
+
const version = '5.0.5';
|
|
5889
6166
|
|
|
5890
6167
|
const NONE$1 = 0;
|
|
5891
6168
|
const HALF = 1;
|
|
@@ -6330,7 +6607,6 @@ function range(start, end) {
|
|
|
6330
6607
|
}
|
|
6331
6608
|
return arr;
|
|
6332
6609
|
}
|
|
6333
|
-
const cache = new Map();
|
|
6334
6610
|
const NONE = {
|
|
6335
6611
|
shacharit: false,
|
|
6336
6612
|
mincha: false,
|
|
@@ -6356,12 +6632,7 @@ function tachanun_(hdate, il) {
|
|
|
6356
6632
|
*/
|
|
6357
6633
|
function tachanun0(hdate, il, checkNext) {
|
|
6358
6634
|
const year = hdate.getFullYear();
|
|
6359
|
-
const
|
|
6360
|
-
const cached = cache.get(key);
|
|
6361
|
-
const dates = cached || tachanunYear(year, il);
|
|
6362
|
-
if (!cached) {
|
|
6363
|
-
cache.set(key, dates);
|
|
6364
|
-
}
|
|
6635
|
+
const dates = tachanunYear(year, il);
|
|
6365
6636
|
const abs = hdate.abs();
|
|
6366
6637
|
if (dates.none.indexOf(abs) > -1) {
|
|
6367
6638
|
return NONE;
|
|
@@ -6911,8 +7182,6 @@ function observedInIsrael(ev) {
|
|
|
6911
7182
|
function observedInDiaspora(ev) {
|
|
6912
7183
|
return ev.observedInDiaspora();
|
|
6913
7184
|
}
|
|
6914
|
-
const yearArrayCache = new Map();
|
|
6915
|
-
const holidaysOnDate = new Map();
|
|
6916
7185
|
|
|
6917
7186
|
/**
|
|
6918
7187
|
* HebrewCalendar is the main interface to the `@hebcal/core` library.
|
|
@@ -7237,15 +7506,10 @@ class HebrewCalendar {
|
|
|
7237
7506
|
* @return {Event[]}
|
|
7238
7507
|
*/
|
|
7239
7508
|
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
7509
|
const yearMap = getHolidaysForYear_(year);
|
|
7246
7510
|
const startAbs = HDate.hebrew2abs(year, TISHREI, 1);
|
|
7247
7511
|
const endAbs = HDate.hebrew2abs(year + 1, TISHREI, 1) - 1;
|
|
7248
|
-
events = [];
|
|
7512
|
+
let events = [];
|
|
7249
7513
|
const myFilter = il ? observedInIsrael : observedInDiaspora;
|
|
7250
7514
|
for (let absDt = startAbs; absDt <= endAbs; absDt++) {
|
|
7251
7515
|
const hd = new HDate(absDt);
|
|
@@ -7255,7 +7519,6 @@ class HebrewCalendar {
|
|
|
7255
7519
|
events = events.concat(filtered);
|
|
7256
7520
|
}
|
|
7257
7521
|
}
|
|
7258
|
-
yearArrayCache.set(cacheKey, events);
|
|
7259
7522
|
return events;
|
|
7260
7523
|
}
|
|
7261
7524
|
|
|
@@ -7268,20 +7531,14 @@ class HebrewCalendar {
|
|
|
7268
7531
|
static getHolidaysOnDate(date, il) {
|
|
7269
7532
|
const hd = HDate.isHDate(date) ? date : new HDate(date);
|
|
7270
7533
|
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
7534
|
const yearMap = getHolidaysForYear_(hd.getFullYear());
|
|
7276
7535
|
const events = yearMap.get(hdStr);
|
|
7277
7536
|
// if il isn't a boolean return both diaspora + IL for day
|
|
7278
7537
|
if (typeof il === 'undefined' || typeof events === 'undefined') {
|
|
7279
|
-
holidaysOnDate.set(cacheKey, events);
|
|
7280
7538
|
return events;
|
|
7281
7539
|
}
|
|
7282
7540
|
const myFilter = il ? observedInIsrael : observedInDiaspora;
|
|
7283
7541
|
const filtered = events.filter(myFilter);
|
|
7284
|
-
holidaysOnDate.set(cacheKey, filtered);
|
|
7285
7542
|
return filtered;
|
|
7286
7543
|
}
|
|
7287
7544
|
|
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.5",
|
|
4
4
|
"author": "Michael J. Radwin (https://github.com/mjradwin)",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Eyal Schachter (https://github.com/Scimonster)",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"repository": {
|
|
36
36
|
"type": "git",
|
|
37
|
-
"url": "https://github.com/hebcal/hebcal-es6.git"
|
|
37
|
+
"url": "git+https://github.com/hebcal/hebcal-es6.git"
|
|
38
38
|
},
|
|
39
39
|
"bugs": {
|
|
40
40
|
"url": "https://github.com/hebcal/hebcal-es6/issues"
|
|
@@ -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",
|
|
@@ -87,6 +87,7 @@
|
|
|
87
87
|
"jsdoc": "^4.0.2",
|
|
88
88
|
"jsdoc-to-markdown": "^8.0.0",
|
|
89
89
|
"nyc": "^15.1.0",
|
|
90
|
+
"quick-lru": "^7.0.0",
|
|
90
91
|
"rollup": "^4.9.1",
|
|
91
92
|
"ttag-cli": "^1.10.10"
|
|
92
93
|
}
|