@hebcal/core 5.0.4 → 5.0.6
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 +260 -11
- package/dist/bundle.min.js +2 -2
- package/dist/index.cjs +303 -11
- package/dist/index.mjs +303 -11
- package/package.json +5 -3
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v5.0.
|
|
1
|
+
/*! @hebcal/core v5.0.6 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
/** @private */
|
|
@@ -4436,6 +4436,300 @@ function getTodayIsHe(omer) {
|
|
|
4436
4436
|
return str.normalize();
|
|
4437
4437
|
}
|
|
4438
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
|
+
|
|
4439
4733
|
/* eslint-disable new-cap */
|
|
4440
4734
|
/*
|
|
4441
4735
|
Hebcal - A Jewish Calendar Generator
|
|
@@ -4822,7 +5116,9 @@ types['1311'] = types['1221'];
|
|
|
4822
5116
|
/* Hebrew year that starts on Saturday, is `complete' (Heshvan and
|
|
4823
5117
|
* Kislev each have 30 days), and has Passover start on Thursday. */
|
|
4824
5118
|
types['1721'] = types['170'];
|
|
4825
|
-
const sedraCache = new
|
|
5119
|
+
const sedraCache = new QuickLRU({
|
|
5120
|
+
maxSize: 400
|
|
5121
|
+
});
|
|
4826
5122
|
|
|
4827
5123
|
/**
|
|
4828
5124
|
* @private
|
|
@@ -5610,7 +5906,9 @@ const emojiIsraelFlag = {
|
|
|
5610
5906
|
emoji: '🇮🇱'
|
|
5611
5907
|
};
|
|
5612
5908
|
const chanukahEmoji = '🕎';
|
|
5613
|
-
const yearCache = new
|
|
5909
|
+
const yearCache = new QuickLRU({
|
|
5910
|
+
maxSize: 400
|
|
5911
|
+
});
|
|
5614
5912
|
const KEYCAP_DIGITS = ['0️⃣', '1️⃣', '2️⃣', '3️⃣', '4️⃣', '5️⃣', '6️⃣', '7️⃣', '8️⃣', '9️⃣'];
|
|
5615
5913
|
|
|
5616
5914
|
/**
|
|
@@ -5866,7 +6164,7 @@ class DailyLearning {
|
|
|
5866
6164
|
}
|
|
5867
6165
|
|
|
5868
6166
|
// DO NOT EDIT THIS AUTO-GENERATED FILE!
|
|
5869
|
-
const version = '5.0.
|
|
6167
|
+
const version = '5.0.6';
|
|
5870
6168
|
|
|
5871
6169
|
const NONE$1 = 0;
|
|
5872
6170
|
const HALF = 1;
|
|
@@ -6311,7 +6609,6 @@ function range(start, end) {
|
|
|
6311
6609
|
}
|
|
6312
6610
|
return arr;
|
|
6313
6611
|
}
|
|
6314
|
-
const cache = new Map();
|
|
6315
6612
|
const NONE = {
|
|
6316
6613
|
shacharit: false,
|
|
6317
6614
|
mincha: false,
|
|
@@ -6337,12 +6634,7 @@ function tachanun_(hdate, il) {
|
|
|
6337
6634
|
*/
|
|
6338
6635
|
function tachanun0(hdate, il, checkNext) {
|
|
6339
6636
|
const year = hdate.getFullYear();
|
|
6340
|
-
const
|
|
6341
|
-
const cached = cache.get(key);
|
|
6342
|
-
const dates = cached || tachanunYear(year, il);
|
|
6343
|
-
if (!cached) {
|
|
6344
|
-
cache.set(key, dates);
|
|
6345
|
-
}
|
|
6637
|
+
const dates = tachanunYear(year, il);
|
|
6346
6638
|
const abs = hdate.abs();
|
|
6347
6639
|
if (dates.none.indexOf(abs) > -1) {
|
|
6348
6640
|
return NONE;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @hebcal/core v5.0.
|
|
1
|
+
/*! @hebcal/core v5.0.6 */
|
|
2
2
|
/** @private */
|
|
3
3
|
const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
4
4
|
/** @private */
|
|
@@ -4434,6 +4434,300 @@ function getTodayIsHe(omer) {
|
|
|
4434
4434
|
return str.normalize();
|
|
4435
4435
|
}
|
|
4436
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
|
+
|
|
4437
4731
|
/* eslint-disable new-cap */
|
|
4438
4732
|
/*
|
|
4439
4733
|
Hebcal - A Jewish Calendar Generator
|
|
@@ -4820,7 +5114,9 @@ types['1311'] = types['1221'];
|
|
|
4820
5114
|
/* Hebrew year that starts on Saturday, is `complete' (Heshvan and
|
|
4821
5115
|
* Kislev each have 30 days), and has Passover start on Thursday. */
|
|
4822
5116
|
types['1721'] = types['170'];
|
|
4823
|
-
const sedraCache = new
|
|
5117
|
+
const sedraCache = new QuickLRU({
|
|
5118
|
+
maxSize: 400
|
|
5119
|
+
});
|
|
4824
5120
|
|
|
4825
5121
|
/**
|
|
4826
5122
|
* @private
|
|
@@ -5608,7 +5904,9 @@ const emojiIsraelFlag = {
|
|
|
5608
5904
|
emoji: '🇮🇱'
|
|
5609
5905
|
};
|
|
5610
5906
|
const chanukahEmoji = '🕎';
|
|
5611
|
-
const yearCache = new
|
|
5907
|
+
const yearCache = new QuickLRU({
|
|
5908
|
+
maxSize: 400
|
|
5909
|
+
});
|
|
5612
5910
|
const KEYCAP_DIGITS = ['0️⃣', '1️⃣', '2️⃣', '3️⃣', '4️⃣', '5️⃣', '6️⃣', '7️⃣', '8️⃣', '9️⃣'];
|
|
5613
5911
|
|
|
5614
5912
|
/**
|
|
@@ -5864,7 +6162,7 @@ class DailyLearning {
|
|
|
5864
6162
|
}
|
|
5865
6163
|
|
|
5866
6164
|
// DO NOT EDIT THIS AUTO-GENERATED FILE!
|
|
5867
|
-
const version = '5.0.
|
|
6165
|
+
const version = '5.0.6';
|
|
5868
6166
|
|
|
5869
6167
|
const NONE$1 = 0;
|
|
5870
6168
|
const HALF = 1;
|
|
@@ -6309,7 +6607,6 @@ function range(start, end) {
|
|
|
6309
6607
|
}
|
|
6310
6608
|
return arr;
|
|
6311
6609
|
}
|
|
6312
|
-
const cache = new Map();
|
|
6313
6610
|
const NONE = {
|
|
6314
6611
|
shacharit: false,
|
|
6315
6612
|
mincha: false,
|
|
@@ -6335,12 +6632,7 @@ function tachanun_(hdate, il) {
|
|
|
6335
6632
|
*/
|
|
6336
6633
|
function tachanun0(hdate, il, checkNext) {
|
|
6337
6634
|
const year = hdate.getFullYear();
|
|
6338
|
-
const
|
|
6339
|
-
const cached = cache.get(key);
|
|
6340
|
-
const dates = cached || tachanunYear(year, il);
|
|
6341
|
-
if (!cached) {
|
|
6342
|
-
cache.set(key, dates);
|
|
6343
|
-
}
|
|
6635
|
+
const dates = tachanunYear(year, il);
|
|
6344
6636
|
const abs = hdate.abs();
|
|
6345
6637
|
if (dates.none.indexOf(abs) > -1) {
|
|
6346
6638
|
return NONE;
|