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