@hebcal/icalendar 4.14.4 → 4.15.2

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.
Files changed (3) hide show
  1. package/dist/index.js +18 -455
  2. package/dist/index.mjs +9 -426
  3. package/package.json +14 -22
package/dist/index.js CHANGED
@@ -1,458 +1,20 @@
1
- /*! @hebcal/icalendar v4.14.4 */
1
+ /*! @hebcal/icalendar v4.15.2 */
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var core = require('@hebcal/core');
7
- var leyn = require('@hebcal/leyning');
7
+ var murmurhash3 = require('murmurhash3');
8
+ var restApi = require('@hebcal/rest-api');
8
9
  var fs = require('fs');
9
10
 
10
- function _interopNamespace(e) {
11
- if (e && e.__esModule) return e;
12
- var n = Object.create(null);
13
- if (e) {
14
- Object.keys(e).forEach(function (k) {
15
- if (k !== 'default') {
16
- var d = Object.getOwnPropertyDescriptor(e, k);
17
- Object.defineProperty(n, k, d.get ? d : {
18
- enumerable: true,
19
- get: function () { return e[k]; }
20
- });
21
- }
22
- });
23
- }
24
- n["default"] = e;
25
- return Object.freeze(n);
26
- }
27
-
28
- var leyn__namespace = /*#__PURE__*/_interopNamespace(leyn);
29
-
30
- var murmurhashJs = {exports: {}};
31
-
32
- var murmurhash3_gc = {exports: {}};
33
-
34
- /**
35
- * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011)
36
- *
37
- * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
38
- * @see http://github.com/garycourt/murmurhash-js
39
- * @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
40
- * @see http://sites.google.com/site/murmurhash/
41
- *
42
- * @param {string} key ASCII only
43
- * @param {number} seed Positive integer only
44
- * @return {number} 32-bit positive integer hash
45
- */
46
-
47
- (function (module) {
48
- function murmurhash3_32_gc(key, seed) {
49
- var remainder, bytes, h1, h1b, c1, c2, k1, i;
50
-
51
- remainder = key.length & 3; // key.length % 4
52
- bytes = key.length - remainder;
53
- h1 = seed;
54
- c1 = 0xcc9e2d51;
55
- c2 = 0x1b873593;
56
- i = 0;
57
-
58
- while (i < bytes) {
59
- k1 =
60
- ((key.charCodeAt(i) & 0xff)) |
61
- ((key.charCodeAt(++i) & 0xff) << 8) |
62
- ((key.charCodeAt(++i) & 0xff) << 16) |
63
- ((key.charCodeAt(++i) & 0xff) << 24);
64
- ++i;
65
-
66
- k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;
67
- k1 = (k1 << 15) | (k1 >>> 17);
68
- k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;
69
-
70
- h1 ^= k1;
71
- h1 = (h1 << 13) | (h1 >>> 19);
72
- h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;
73
- h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));
74
- }
75
-
76
- k1 = 0;
77
-
78
- switch (remainder) {
79
- case 3: k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
80
- case 2: k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
81
- case 1: k1 ^= (key.charCodeAt(i) & 0xff);
82
-
83
- k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;
84
- k1 = (k1 << 15) | (k1 >>> 17);
85
- k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;
86
- h1 ^= k1;
87
- }
88
-
89
- h1 ^= key.length;
90
-
91
- h1 ^= h1 >>> 16;
92
- h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;
93
- h1 ^= h1 >>> 13;
94
- h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;
95
- h1 ^= h1 >>> 16;
96
-
97
- return h1 >>> 0;
98
- }
99
-
100
- {
101
- module.exports = murmurhash3_32_gc;
102
- }
103
- }(murmurhash3_gc));
104
-
105
- var murmurhash2_gc = {exports: {}};
106
-
107
- /**
108
- * JS Implementation of MurmurHash2
109
- *
110
- * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
111
- * @see http://github.com/garycourt/murmurhash-js
112
- * @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
113
- * @see http://sites.google.com/site/murmurhash/
114
- *
115
- * @param {string} str ASCII only
116
- * @param {number} seed Positive integer only
117
- * @return {number} 32-bit positive integer hash
118
- */
119
-
120
- (function (module) {
121
- function murmurhash2_32_gc(str, seed) {
122
- var
123
- l = str.length,
124
- h = seed ^ l,
125
- i = 0,
126
- k;
127
-
128
- while (l >= 4) {
129
- k =
130
- ((str.charCodeAt(i) & 0xff)) |
131
- ((str.charCodeAt(++i) & 0xff) << 8) |
132
- ((str.charCodeAt(++i) & 0xff) << 16) |
133
- ((str.charCodeAt(++i) & 0xff) << 24);
134
-
135
- k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16));
136
- k ^= k >>> 24;
137
- k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16));
138
-
139
- h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)) ^ k;
140
-
141
- l -= 4;
142
- ++i;
143
- }
144
-
145
- switch (l) {
146
- case 3: h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
147
- case 2: h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
148
- case 1: h ^= (str.charCodeAt(i) & 0xff);
149
- h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16));
150
- }
151
-
152
- h ^= h >>> 13;
153
- h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16));
154
- h ^= h >>> 15;
155
-
156
- return h >>> 0;
157
- }
158
-
159
- {
160
- module.exports = murmurhash2_32_gc;
161
- }
162
- }(murmurhash2_gc));
163
-
164
- var murmur3 = murmurhash3_gc.exports;
165
- var murmur2 = murmurhash2_gc.exports;
166
-
167
- murmurhashJs.exports = murmur3;
168
- var murmur3_1 = murmurhashJs.exports.murmur3 = murmur3;
169
- murmurhashJs.exports.murmur2 = murmur2;
170
-
171
- /*! @hebcal/rest-api v3.8.6 */
172
-
173
- var Chanukah="Hanukkah, the Jewish festival of rededication. Also known as the Festival of Lights";var Pesach="Passover, the Feast of Unleavened Bread. Also called Chag HaMatzot (the Festival of Matzah), it commemorates the Exodus and freedom of the Israelites from ancient Egypt";var Purim="Celebration of Jewish deliverance as told by Megilat Esther. It commemorates a time when the Jewish people living in Persia were saved from extermination";var Shavuot="Festival of Weeks. Commemorates the giving of the Torah at Mount Sinai";var Sigd="Ethiopian Jewish holiday occurring 50 days after Yom Kippur";var Sukkot="Feast of Booths";var holidayDescription = {"Asara B'Tevet":"Fast commemorating the siege of Jerusalem",Chanukah:Chanukah,"Days of the Omer":"7 weeks from the second night of Pesach to the day before Shavuot","Lag BaOmer":"33rd day of counting the Omer","Leil Selichot":"Prayers for forgiveness in preparation for the High Holidays","Pesach Sheni":"Second Passover, one month after Passover",Pesach:Pesach,"Purim Katan":"Minor Purim celebration during Adar I on leap years",Purim:Purim,"Rosh Chodesh Nisan":"Start of month of Nisan on the Hebrew calendar. נִיסָן (transliterated Nisan or Nissan) is the 1st month of the Hebrew year, has 30 days, and corresponds to March or April on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Iyyar":"Start of month of Iyyar on the Hebrew calendar. אִיָיר (transliterated Iyyar or Iyar) is the 2nd month of the Hebrew year, has 29 days, and corresponds to April or May on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Sivan":"Start of month of Sivan on the Hebrew calendar. Sivan (סִיוָן) is the 3rd month of the Hebrew year, has 30 days, and corresponds to May or June on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Tamuz":"Start of month of Tamuz on the Hebrew calendar. תַּמּוּז (transliterated Tamuz or Tammuz) is the 4th month of the Hebrew year, has 29 days, and corresponds to June or July on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Av":"Start of month of Av on the Hebrew calendar. Av (אָב) is the 5th month of the Hebrew year, has 30 days, and corresponds to July or August on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Elul":"Start of month of Elul on the Hebrew calendar. Elul (אֱלוּל) is the 6th month of the Hebrew year, has 29 days, and corresponds to August or September on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Cheshvan":"Start of month of Cheshvan on the Hebrew calendar. חֶשְׁוָן (transliterated Cheshvan or Heshvan) is the 8th month of the Hebrew year, has 29 or 30 days, and corresponds to October or November on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Kislev":"Start of month of Kislev on the Hebrew calendar. Kislev (כִּסְלֵו) is the 9th month of the Hebrew year, has 30 or 29 days, and corresponds to November or December on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Tevet":"Start of month of Tevet on the Hebrew calendar. Tevet (טֵבֵת) is the 10th month of the Hebrew year, has 29 days, and corresponds to December or January on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Sh'vat":"Start of month of Sh'vat on the Hebrew calendar. שְׁבָט (transliterated Sh'vat or Shevat) is the 11th month of the Hebrew year, has 30 days, and corresponds to January or February on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Adar":"Start of month of Adar on the Hebrew calendar. Adar (אַדָר) is the 12th month of the Hebrew year, has 29 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Adar I":"Start of month of Adar I (on leap years) on the Hebrew calendar. Adar I (אַדָר א׳) is the 12th month of the Hebrew year, occurs only on leap years, has 30 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Adar II":"Start of month of Adar II (on leap years) on the Hebrew calendar. Adar II (אַדָר ב׳), sometimes \"Adar Bet\" or \"Adar Sheni\", is the 13th month of the Hebrew year, has 29 days, occurs only on leap years, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Hashana":"The Jewish New Year. Also spelled Rosh Hashanah","Rosh Hashana LaBehemot":"New Year for Tithing Animals","Shabbat Chazon":"Shabbat before Tish'a B'Av (Shabbat of Prophecy/Shabbat of Vision)","Shabbat HaChodesh":"Shabbat before Rosh Chodesh Nissan","Shabbat HaGadol":"Shabbat before Pesach","Shabbat Machar Chodesh":"When Shabbat falls the day before Rosh Chodesh","Shabbat Nachamu":"Shabbat after Tish'a B'Av (Shabbat of Consolation). The first of seven Shabbatot leading up to Rosh Hashanah. Named after the Haftarah (from Isaiah 40) which begins with the verse נַחֲמוּ נַחֲמוּ, עַמִּי (\"Comfort, oh comfort my people\")","Shabbat Parah":"Shabbat of the Red Heifer","Shabbat Rosh Chodesh":"When Shabbat falls on Rosh Chodesh","Shabbat Shekalim":"Shabbat before Rosh Chodesh Adar","Shabbat Shirah":"Shabbat of Song","Shabbat Shuva":"Shabbat that falls between Rosh Hashanah and Yom Kippur (Shabbat of Returning)","Shabbat Zachor":"Shabbat before Purim",Shavuot:Shavuot,"Shmini Atzeret":"Eighth Day of Assembly","Shushan Purim":"Purim celebrated in Jerusalem and walled cities",Sigd:Sigd,"Simchat Torah":"Day of Celebrating the Torah",Sukkot:Sukkot,"Ta'anit Bechorot":"Fast of the First Born","Ta'anit Esther":"Fast of Esther","Tish'a B'Av":"The Ninth of Av. Fast commemorating the destruction of the two Temples","Tu B'Av":"Minor Jewish holiday of love. Observed on the 15th day of the Hebrew month of Av","Tu BiShvat":"New Year for Trees","Tzom Gedaliah":"Fast of the Seventh Month. Commemorates the assassination of the Jewish governor of Judah","Tzom Tammuz":"Fast commemorating breaching of the walls of Jerusalem before the destruction of the Second Temple","Yom HaAliyah":"Recognizes Aliyah, immigration to the Jewish State of Israel","Yom HaAliyah School Observance":"Aliyah Day observed in Israeli schools","Yom HaAtzma'ut":"Israeli Independence Day. Commemorates the declaration of independence of Israel in 1948. Note that Hebcal displays modern holidays like Yom HaAtzma'ut according to the Israeli schedule. Although Yom HaAtzma'ut is normally observed on the 5th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaZikaron, which always precedes it) would conflict with Shabbat","Yom HaShoah":"Holocaust Memorial Day","Yom HaZikaron":"Israeli Memorial Day. Note that Hebcal displays modern holidays like Yom HaZikaron according to the Israeli schedule. Although Yom Hazikaron is normally observed on the 4th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaAtzma'ut, which always follows it) would conflict with Shabbat","Yom Kippur":"Day of Atonement","Yom Yerushalayim":"Jerusalem Day. Commemorates the re-unification of Jerusalem in 1967"};
174
-
175
- /**
176
- * Helper function to transform a string to make it more usable in a URL or filename.
177
- * Converts to lowercase and replaces non-word characters with hyphen ('-').
178
- * @example
179
- * makeAnchor('Rosh Chodesh Adar II') // 'rosh-chodesh-adar-ii'
180
- * @param {string} s
181
- * @return {string}
182
- */
183
-
184
- function makeAnchor(s) {
185
- return s.toLowerCase().replace(/'/g, '').replace(/[^\w]/g, '-').replace(/-+/g, '-').replace(/^-/g, '').replace(/-$/g, '');
186
- }
187
- /**
188
- * @param {number} number
189
- * @return {string}
190
- */
191
-
192
- function pad2(number) {
193
- if (number < 10) {
194
- return '0' + number;
195
- }
196
-
197
- return String(number);
198
- }
199
- /**
200
- * @param {number} number
201
- * @return {string}
202
- */
203
-
204
- function pad4(number) {
205
- if (number < 0) {
206
- return '-00' + pad4(-number);
207
- } else if (number < 10) {
208
- return '000' + number;
209
- } else if (number < 100) {
210
- return '00' + number;
211
- } else if (number < 1000) {
212
- return '0' + number;
213
- }
214
-
215
- return String(number);
216
- }
217
- /**
218
- * Returns a category and subcategory name
219
- * @param {Event} ev
220
- * @return {string[]}
221
- */
222
-
223
- function getEventCategories(ev) {
224
- const desc = ev.getDesc(); // since these use flags.MINOR_FAST or flags.MAJOR_FAST, check description first
225
-
226
- if (desc === 'Fast begins' || desc === 'Fast ends') {
227
- return ['zmanim', 'fast'];
228
- }
229
-
230
- switch (ev.getFlags()) {
231
- case core.flags.OMER_COUNT:
232
- return ['omer'];
233
-
234
- case core.flags.HEBREW_DATE:
235
- return ['hebdate'];
236
-
237
- case core.flags.PARSHA_HASHAVUA:
238
- return ['parashat'];
239
- // backwards-compat
240
-
241
- case core.flags.DAF_YOMI:
242
- return ['dafyomi'];
243
-
244
- case core.flags.ROSH_CHODESH:
245
- return ['roshchodesh'];
246
-
247
- case core.flags.SPECIAL_SHABBAT:
248
- return ['holiday', 'shabbat'];
249
-
250
- case core.flags.MINOR_FAST:
251
- return ['holiday', 'fast'];
252
-
253
- case core.flags.MAJOR_FAST:
254
- return ['holiday', 'fast', 'major'];
255
-
256
- case core.flags.MODERN_HOLIDAY:
257
- return ['holiday', 'modern'];
258
-
259
- case core.flags.SHABBAT_MEVARCHIM:
260
- return ['mevarchim'];
261
-
262
- case core.flags.MOLAD:
263
- return ['molad'];
264
-
265
- case core.flags.USER_EVENT:
266
- return ['user'];
267
-
268
- case core.flags.MINOR_HOLIDAY:
269
- return ['holiday', 'minor'];
270
- // fall through to string-based category
271
- }
272
-
273
- if (ev.cholHaMoedDay) {
274
- return ['holiday', 'major', 'cholhamoed'];
275
- }
276
-
277
- switch (desc) {
278
- case 'Havdalah':
279
- return ['havdalah'];
280
-
281
- case 'Candle lighting':
282
- return ['candles'];
283
-
284
- case 'Lag BaOmer':
285
- case 'Leil Selichot':
286
- case 'Pesach Sheni':
287
- case 'Erev Purim':
288
- case 'Purim Katan':
289
- case 'Shushan Purim':
290
- case 'Tu B\'Av':
291
- case 'Tu BiShvat':
292
- case 'Rosh Hashana LaBehemot':
293
- return ['holiday', 'minor'];
294
-
295
- case 'Erev Tish\'a B\'Av':
296
- return ['holiday', 'fast', 'major'];
297
-
298
- default:
299
- return ['holiday', 'major'];
300
- }
301
- }
302
- /**
303
- * Generates a title like "Hebcal 2020 Israel" or "Hebcal May 1993 Providence"
304
- * @param {Event[]} events
305
- * @param {HebrewCalendar.Options} options
306
- * @return {string}
307
- */
308
-
309
- function getCalendarTitle(events, options) {
310
- let title = 'Hebcal';
311
- const location = options.location;
312
-
313
- if (options.yahrzeit) {
314
- title += ' Yahrzeits and Anniversaries';
315
- } else if (location && location.name) {
316
- const comma = location.name.indexOf(',');
317
- const name = comma == -1 ? location.name : location.name.substring(0, comma);
318
- title += ' ' + name;
319
- } else if (options.il) {
320
- title += ' Israel';
321
- } else {
322
- title += ' Diaspora';
323
- }
324
-
325
- if (options.isHebrewYear || events.length == 0) {
326
- title += ' ' + options.year;
327
- } else {
328
- const start = events[0].getDate().greg();
329
- const end = events[events.length - 1].getDate().greg();
330
-
331
- if (start.getFullYear() != end.getFullYear()) {
332
- title += ' ' + start.getFullYear() + '-' + end.getFullYear();
333
- } else if (start.getMonth() == end.getMonth()) {
334
- const monthFormat = new Intl.DateTimeFormat('en-US', {
335
- month: 'long'
336
- });
337
- const startMonth = monthFormat.format(start);
338
- title += ' ' + startMonth + ' ' + start.getFullYear();
339
- } else {
340
- title += ' ' + start.getFullYear();
341
- }
342
- }
343
-
344
- return title;
345
- }
346
- /**
347
- * Returns an English language description of the holiday
348
- * @param {Event} ev
349
- * @param {boolean} [firstSentence=false]
350
- * @return {string}
351
- */
352
-
353
- function getHolidayDescription(ev, firstSentence = false) {
354
- const str = holidayDescription[ev.getDesc()] || holidayDescription[ev.basename()] || '';
355
-
356
- if (firstSentence && str) {
357
- const dot = str.indexOf('.');
358
-
359
- if (dot != -1) {
360
- return str.substring(0, dot);
361
- }
362
- }
363
-
364
- return str;
365
- }
366
- const HOLIDAY_IGNORE_MASK$1 = core.flags.DAF_YOMI | core.flags.OMER_COUNT | core.flags.SHABBAT_MEVARCHIM | core.flags.MOLAD | core.flags.USER_EVENT | core.flags.HEBREW_DATE;
367
- /**
368
- * Makes mulit-line text that summarizes Torah & Haftarah
369
- * @param {Event} ev
370
- * @param {boolean} il
371
- * @return {string}
372
- */
373
-
374
- function makeTorahMemoText(ev, il) {
375
- const mask = ev.getFlags();
376
-
377
- if (mask & HOLIDAY_IGNORE_MASK$1) {
378
- return '';
379
- }
380
-
381
- const reading = mask & core.flags.PARSHA_HASHAVUA ? leyn__namespace.getLeyningForParshaHaShavua(ev, il) : leyn__namespace.getLeyningForHoliday(ev, il);
382
- let memo = '';
383
-
384
- if (reading && (reading.summary || reading.haftara)) {
385
- if (reading.summary) {
386
- memo += `Torah: ${reading.summary}`;
387
- }
388
-
389
- if (reading.summary && reading.haftara) {
390
- memo += '\n';
391
- }
392
-
393
- if (reading.haftara) {
394
- memo += 'Haftarah: ' + reading.haftara;
395
-
396
- if (reading.reason && reading.reason.haftara) {
397
- memo += ' | ' + reading.reason.haftara;
398
- }
399
- }
400
- }
401
-
402
- if (reading && reading.sephardic) {
403
- memo += '\nHaftarah for Sephardim: ' + reading.sephardic;
404
- }
405
-
406
- return memo;
407
- }
408
- /**
409
- * Appends utm_source and utm_medium parameters to a URL
410
- * @param {string} url
411
- * @param {boolean} il
412
- * @param {string} utmSource
413
- * @param {string} utmMedium
414
- * @param {string} utmCampaign
415
- * @return {string}
416
- */
417
-
418
- function appendIsraelAndTracking(url, il, utmSource, utmMedium, utmCampaign) {
419
- if (url.substring(0, 22) !== 'https://www.hebcal.com') {
420
- utmSource = 'hebcal.com';
421
- } else if (il && url.indexOf('?') === -1) {
422
- url += '?i=on';
423
- }
424
-
425
- const sep = url.indexOf('?') === -1 ? '?' : '&';
426
- const utm = `utm_source=${utmSource}&utm_medium=${utmMedium}`;
427
- const campaign = utmCampaign ? `&utm_campaign=${utmCampaign}` : '';
428
- return url + sep + utm + campaign;
429
- }
430
- /**
431
- * @private
432
- * @param {Event} ev
433
- * @return {boolean}
434
- */
435
-
436
- function shouldRenderBrief(ev) {
437
- if (typeof ev.eventTime !== 'undefined') return true;
438
- const mask = ev.getFlags();
439
-
440
- if (mask & core.flags.HEBREW_DATE) {
441
- const hd = ev.getDate();
442
- return hd.getDate() === 1 ? false : true;
443
- } else if (mask & core.flags.DAF_YOMI) {
444
- return true;
445
- } else {
446
- return false;
447
- }
448
- }
449
-
450
- var version="4.14.4";
11
+ var version="4.15.2";
451
12
 
452
13
  const VTIMEZONE = {};
453
14
  const CATEGORY = {
454
15
  candles: 'Holiday',
455
16
  dafyomi: 'Daf Yomi',
17
+ mishnayomi: 'Mishna Yomi',
456
18
  havdalah: 'Holiday',
457
19
  hebdate: null,
458
20
  holiday: 'Holiday',
@@ -493,7 +55,7 @@ function appendTrackingToUrl(url, options) {
493
55
  const utmSource = options.utmSource || 'js';
494
56
  const utmMedium = options.utmMedium || 'icalendar';
495
57
  const utmCampaign = options.utmCampaign;
496
- return appendIsraelAndTracking(url, options.il, utmSource, utmMedium, utmCampaign);
58
+ return restApi.appendIsraelAndTracking(url, options.il, utmSource, utmMedium, utmCampaign);
497
59
  }
498
60
 
499
61
  const encoder = new TextEncoder();
@@ -514,13 +76,15 @@ class IcalEvent {
514
76
  this.dtstamp = options.dtstamp || IcalEvent.makeDtstamp(new Date());
515
77
  const timed = this.timed = Boolean(ev.eventTime);
516
78
  const locale = options.locale;
517
- let subj = shouldRenderBrief(ev) ? ev.renderBrief(locale) : ev.render(locale);
79
+ let subj = restApi.shouldRenderBrief(ev) ? ev.renderBrief(locale) : ev.render(locale);
518
80
  const mask = ev.getFlags();
519
81
 
520
82
  if (ev.locationName) {
521
83
  this.locationName = ev.locationName;
522
84
  } else if (mask & core.flags.DAF_YOMI) {
523
85
  this.locationName = core.Locale.gettext('Daf Yomi');
86
+ } else if (mask & core.flags.MISHNA_YOMI) {
87
+ this.locationName = core.Locale.gettext('Mishna Yomi');
524
88
  } else if (timed && options.location && options.location.name) {
525
89
  const comma = options.location.name.indexOf(',');
526
90
  this.locationName = comma == -1 ? options.location.name : options.location.name.substring(0, comma);
@@ -536,7 +100,7 @@ class IcalEvent {
536
100
  let [hour, minute] = ev.eventTimeStr.split(':');
537
101
  hour = +hour;
538
102
  minute = +minute;
539
- this.startDate += 'T' + pad2(hour) + pad2(minute) + '00';
103
+ this.startDate += 'T' + restApi.pad2(hour) + restApi.pad2(minute) + '00';
540
104
  this.endDate = this.startDate;
541
105
 
542
106
  if (options.location && options.location.tzid) {
@@ -587,24 +151,23 @@ class IcalEvent {
587
151
  this.alarm = '-P0DT0H10M0S'; // ten minutes
588
152
  }
589
153
 
590
- this.category = ev.category || CATEGORY[getEventCategories(ev)[0]];
154
+ this.category = ev.category || CATEGORY[restApi.getEventCategories(ev)[0]];
591
155
  }
592
156
  /**
593
- * @private
594
157
  * @return {string}
595
158
  */
596
159
 
597
160
 
598
161
  getUid() {
599
162
  const options = this.options;
600
- const digest = murmur3_1(this.ev.getDesc()).toString(16);
163
+ const digest = murmurhash3.murmur32HexSync(this.ev.getDesc());
601
164
  let uid = `hebcal-${this.startDate}-${digest}`;
602
165
 
603
166
  if (this.timed && options.location) {
604
167
  if (options.location.geoid) {
605
168
  uid += `-${options.location.geoid}`;
606
169
  } else if (options.location.name) {
607
- uid += '-' + makeAnchor(options.location.name);
170
+ uid += '-' + restApi.makeAnchor(options.location.name);
608
171
  }
609
172
  }
610
173
 
@@ -741,7 +304,7 @@ class IcalEvent {
741
304
 
742
305
 
743
306
  static formatYYYYMMDD(dt) {
744
- return pad4(dt.getFullYear()) + pad2(dt.getMonth() + 1) + pad2(dt.getDate());
307
+ return restApi.pad4(dt.getFullYear()) + restApi.pad2(dt.getMonth() + 1) + restApi.pad2(dt.getDate());
745
308
  }
746
309
  /**
747
310
  * Returns UTC string for iCalendar
@@ -774,7 +337,7 @@ function eventToIcal(ev, options) {
774
337
  return ical.toString();
775
338
  }
776
339
  const torahMemoCache = new Map();
777
- const HOLIDAY_IGNORE_MASK = core.flags.DAF_YOMI | core.flags.OMER_COUNT | core.flags.SHABBAT_MEVARCHIM | core.flags.MOLAD | core.flags.USER_EVENT | core.flags.HEBREW_DATE;
340
+ const HOLIDAY_IGNORE_MASK = core.flags.DAF_YOMI | core.flags.OMER_COUNT | core.flags.SHABBAT_MEVARCHIM | core.flags.MOLAD | core.flags.USER_EVENT | core.flags.MISHNA_YOMI | core.flags.HEBREW_DATE;
778
341
  /**
779
342
  * @private
780
343
  * @param {Event} ev
@@ -798,7 +361,7 @@ function makeTorahMemo(ev, il) {
798
361
  return memo;
799
362
  }
800
363
 
801
- memo = makeTorahMemoText(ev, il).replace(/\n/g, '\\n');
364
+ memo = restApi.makeTorahMemoText(ev, il).replace(/\n/g, '\\n');
802
365
  torahMemoCache.set(key, memo);
803
366
  return memo;
804
367
  }
@@ -830,7 +393,7 @@ function createMemo(e, options) {
830
393
  if (mask & core.flags.PARSHA_HASHAVUA) {
831
394
  return torahMemo + '\\n\\n' + url;
832
395
  } else {
833
- let memo = e.memo || getHolidayDescription(e);
396
+ let memo = e.memo || restApi.getHolidayDescription(e);
834
397
 
835
398
  if (!memo && typeof e.linkedEvent !== 'undefined') {
836
399
  memo = e.linkedEvent.render(options.locale);
@@ -866,7 +429,7 @@ async function eventsToIcalendar(events, options) {
866
429
  opts.dtstamp = opts.dtstamp || IcalEvent.makeDtstamp(new Date());
867
430
 
868
431
  if (!opts.title) {
869
- opts.title = getCalendarTitle(events, opts);
432
+ opts.title = restApi.getCalendarTitle(events, opts);
870
433
  }
871
434
 
872
435
  const icals = events.map(ev => new IcalEvent(ev, opts));
package/dist/index.mjs CHANGED
@@ -1,434 +1,16 @@
1
- /*! @hebcal/icalendar v4.14.4 */
1
+ /*! @hebcal/icalendar v4.15.2 */
2
2
  import { flags, Locale } from '@hebcal/core';
3
- import * as leyn from '@hebcal/leyning';
3
+ import { murmur32HexSync } from 'murmurhash3';
4
+ import { shouldRenderBrief, pad2, getEventCategories, makeAnchor, pad4, getHolidayDescription, getCalendarTitle, appendIsraelAndTracking, makeTorahMemoText } from '@hebcal/rest-api';
4
5
  import { promises } from 'fs';
5
6
 
6
- var murmurhashJs = {exports: {}};
7
-
8
- var murmurhash3_gc = {exports: {}};
9
-
10
- /**
11
- * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011)
12
- *
13
- * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
14
- * @see http://github.com/garycourt/murmurhash-js
15
- * @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
16
- * @see http://sites.google.com/site/murmurhash/
17
- *
18
- * @param {string} key ASCII only
19
- * @param {number} seed Positive integer only
20
- * @return {number} 32-bit positive integer hash
21
- */
22
-
23
- (function (module) {
24
- function murmurhash3_32_gc(key, seed) {
25
- var remainder, bytes, h1, h1b, c1, c2, k1, i;
26
-
27
- remainder = key.length & 3; // key.length % 4
28
- bytes = key.length - remainder;
29
- h1 = seed;
30
- c1 = 0xcc9e2d51;
31
- c2 = 0x1b873593;
32
- i = 0;
33
-
34
- while (i < bytes) {
35
- k1 =
36
- ((key.charCodeAt(i) & 0xff)) |
37
- ((key.charCodeAt(++i) & 0xff) << 8) |
38
- ((key.charCodeAt(++i) & 0xff) << 16) |
39
- ((key.charCodeAt(++i) & 0xff) << 24);
40
- ++i;
41
-
42
- k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;
43
- k1 = (k1 << 15) | (k1 >>> 17);
44
- k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;
45
-
46
- h1 ^= k1;
47
- h1 = (h1 << 13) | (h1 >>> 19);
48
- h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;
49
- h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));
50
- }
51
-
52
- k1 = 0;
53
-
54
- switch (remainder) {
55
- case 3: k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
56
- case 2: k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
57
- case 1: k1 ^= (key.charCodeAt(i) & 0xff);
58
-
59
- k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;
60
- k1 = (k1 << 15) | (k1 >>> 17);
61
- k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;
62
- h1 ^= k1;
63
- }
64
-
65
- h1 ^= key.length;
66
-
67
- h1 ^= h1 >>> 16;
68
- h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;
69
- h1 ^= h1 >>> 13;
70
- h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;
71
- h1 ^= h1 >>> 16;
72
-
73
- return h1 >>> 0;
74
- }
75
-
76
- {
77
- module.exports = murmurhash3_32_gc;
78
- }
79
- }(murmurhash3_gc));
80
-
81
- var murmurhash2_gc = {exports: {}};
82
-
83
- /**
84
- * JS Implementation of MurmurHash2
85
- *
86
- * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
87
- * @see http://github.com/garycourt/murmurhash-js
88
- * @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
89
- * @see http://sites.google.com/site/murmurhash/
90
- *
91
- * @param {string} str ASCII only
92
- * @param {number} seed Positive integer only
93
- * @return {number} 32-bit positive integer hash
94
- */
95
-
96
- (function (module) {
97
- function murmurhash2_32_gc(str, seed) {
98
- var
99
- l = str.length,
100
- h = seed ^ l,
101
- i = 0,
102
- k;
103
-
104
- while (l >= 4) {
105
- k =
106
- ((str.charCodeAt(i) & 0xff)) |
107
- ((str.charCodeAt(++i) & 0xff) << 8) |
108
- ((str.charCodeAt(++i) & 0xff) << 16) |
109
- ((str.charCodeAt(++i) & 0xff) << 24);
110
-
111
- k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16));
112
- k ^= k >>> 24;
113
- k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16));
114
-
115
- h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)) ^ k;
116
-
117
- l -= 4;
118
- ++i;
119
- }
120
-
121
- switch (l) {
122
- case 3: h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
123
- case 2: h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
124
- case 1: h ^= (str.charCodeAt(i) & 0xff);
125
- h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16));
126
- }
127
-
128
- h ^= h >>> 13;
129
- h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16));
130
- h ^= h >>> 15;
131
-
132
- return h >>> 0;
133
- }
134
-
135
- {
136
- module.exports = murmurhash2_32_gc;
137
- }
138
- }(murmurhash2_gc));
139
-
140
- var murmur3 = murmurhash3_gc.exports;
141
- var murmur2 = murmurhash2_gc.exports;
142
-
143
- murmurhashJs.exports = murmur3;
144
- var murmur3_1 = murmurhashJs.exports.murmur3 = murmur3;
145
- murmurhashJs.exports.murmur2 = murmur2;
146
-
147
- /*! @hebcal/rest-api v3.8.6 */
148
-
149
- var Chanukah="Hanukkah, the Jewish festival of rededication. Also known as the Festival of Lights";var Pesach="Passover, the Feast of Unleavened Bread. Also called Chag HaMatzot (the Festival of Matzah), it commemorates the Exodus and freedom of the Israelites from ancient Egypt";var Purim="Celebration of Jewish deliverance as told by Megilat Esther. It commemorates a time when the Jewish people living in Persia were saved from extermination";var Shavuot="Festival of Weeks. Commemorates the giving of the Torah at Mount Sinai";var Sigd="Ethiopian Jewish holiday occurring 50 days after Yom Kippur";var Sukkot="Feast of Booths";var holidayDescription = {"Asara B'Tevet":"Fast commemorating the siege of Jerusalem",Chanukah:Chanukah,"Days of the Omer":"7 weeks from the second night of Pesach to the day before Shavuot","Lag BaOmer":"33rd day of counting the Omer","Leil Selichot":"Prayers for forgiveness in preparation for the High Holidays","Pesach Sheni":"Second Passover, one month after Passover",Pesach:Pesach,"Purim Katan":"Minor Purim celebration during Adar I on leap years",Purim:Purim,"Rosh Chodesh Nisan":"Start of month of Nisan on the Hebrew calendar. נִיסָן (transliterated Nisan or Nissan) is the 1st month of the Hebrew year, has 30 days, and corresponds to March or April on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Iyyar":"Start of month of Iyyar on the Hebrew calendar. אִיָיר (transliterated Iyyar or Iyar) is the 2nd month of the Hebrew year, has 29 days, and corresponds to April or May on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Sivan":"Start of month of Sivan on the Hebrew calendar. Sivan (סִיוָן) is the 3rd month of the Hebrew year, has 30 days, and corresponds to May or June on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Tamuz":"Start of month of Tamuz on the Hebrew calendar. תַּמּוּז (transliterated Tamuz or Tammuz) is the 4th month of the Hebrew year, has 29 days, and corresponds to June or July on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Av":"Start of month of Av on the Hebrew calendar. Av (אָב) is the 5th month of the Hebrew year, has 30 days, and corresponds to July or August on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Elul":"Start of month of Elul on the Hebrew calendar. Elul (אֱלוּל) is the 6th month of the Hebrew year, has 29 days, and corresponds to August or September on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Cheshvan":"Start of month of Cheshvan on the Hebrew calendar. חֶשְׁוָן (transliterated Cheshvan or Heshvan) is the 8th month of the Hebrew year, has 29 or 30 days, and corresponds to October or November on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Kislev":"Start of month of Kislev on the Hebrew calendar. Kislev (כִּסְלֵו) is the 9th month of the Hebrew year, has 30 or 29 days, and corresponds to November or December on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Tevet":"Start of month of Tevet on the Hebrew calendar. Tevet (טֵבֵת) is the 10th month of the Hebrew year, has 29 days, and corresponds to December or January on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Sh'vat":"Start of month of Sh'vat on the Hebrew calendar. שְׁבָט (transliterated Sh'vat or Shevat) is the 11th month of the Hebrew year, has 30 days, and corresponds to January or February on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Adar":"Start of month of Adar on the Hebrew calendar. Adar (אַדָר) is the 12th month of the Hebrew year, has 29 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Adar I":"Start of month of Adar I (on leap years) on the Hebrew calendar. Adar I (אַדָר א׳) is the 12th month of the Hebrew year, occurs only on leap years, has 30 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Adar II":"Start of month of Adar II (on leap years) on the Hebrew calendar. Adar II (אַדָר ב׳), sometimes \"Adar Bet\" or \"Adar Sheni\", is the 13th month of the Hebrew year, has 29 days, occurs only on leap years, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Hashana":"The Jewish New Year. Also spelled Rosh Hashanah","Rosh Hashana LaBehemot":"New Year for Tithing Animals","Shabbat Chazon":"Shabbat before Tish'a B'Av (Shabbat of Prophecy/Shabbat of Vision)","Shabbat HaChodesh":"Shabbat before Rosh Chodesh Nissan","Shabbat HaGadol":"Shabbat before Pesach","Shabbat Machar Chodesh":"When Shabbat falls the day before Rosh Chodesh","Shabbat Nachamu":"Shabbat after Tish'a B'Av (Shabbat of Consolation). The first of seven Shabbatot leading up to Rosh Hashanah. Named after the Haftarah (from Isaiah 40) which begins with the verse נַחֲמוּ נַחֲמוּ, עַמִּי (\"Comfort, oh comfort my people\")","Shabbat Parah":"Shabbat of the Red Heifer","Shabbat Rosh Chodesh":"When Shabbat falls on Rosh Chodesh","Shabbat Shekalim":"Shabbat before Rosh Chodesh Adar","Shabbat Shirah":"Shabbat of Song","Shabbat Shuva":"Shabbat that falls between Rosh Hashanah and Yom Kippur (Shabbat of Returning)","Shabbat Zachor":"Shabbat before Purim",Shavuot:Shavuot,"Shmini Atzeret":"Eighth Day of Assembly","Shushan Purim":"Purim celebrated in Jerusalem and walled cities",Sigd:Sigd,"Simchat Torah":"Day of Celebrating the Torah",Sukkot:Sukkot,"Ta'anit Bechorot":"Fast of the First Born","Ta'anit Esther":"Fast of Esther","Tish'a B'Av":"The Ninth of Av. Fast commemorating the destruction of the two Temples","Tu B'Av":"Minor Jewish holiday of love. Observed on the 15th day of the Hebrew month of Av","Tu BiShvat":"New Year for Trees","Tzom Gedaliah":"Fast of the Seventh Month. Commemorates the assassination of the Jewish governor of Judah","Tzom Tammuz":"Fast commemorating breaching of the walls of Jerusalem before the destruction of the Second Temple","Yom HaAliyah":"Recognizes Aliyah, immigration to the Jewish State of Israel","Yom HaAliyah School Observance":"Aliyah Day observed in Israeli schools","Yom HaAtzma'ut":"Israeli Independence Day. Commemorates the declaration of independence of Israel in 1948. Note that Hebcal displays modern holidays like Yom HaAtzma'ut according to the Israeli schedule. Although Yom HaAtzma'ut is normally observed on the 5th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaZikaron, which always precedes it) would conflict with Shabbat","Yom HaShoah":"Holocaust Memorial Day","Yom HaZikaron":"Israeli Memorial Day. Note that Hebcal displays modern holidays like Yom HaZikaron according to the Israeli schedule. Although Yom Hazikaron is normally observed on the 4th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaAtzma'ut, which always follows it) would conflict with Shabbat","Yom Kippur":"Day of Atonement","Yom Yerushalayim":"Jerusalem Day. Commemorates the re-unification of Jerusalem in 1967"};
150
-
151
- /**
152
- * Helper function to transform a string to make it more usable in a URL or filename.
153
- * Converts to lowercase and replaces non-word characters with hyphen ('-').
154
- * @example
155
- * makeAnchor('Rosh Chodesh Adar II') // 'rosh-chodesh-adar-ii'
156
- * @param {string} s
157
- * @return {string}
158
- */
159
-
160
- function makeAnchor(s) {
161
- return s.toLowerCase().replace(/'/g, '').replace(/[^\w]/g, '-').replace(/-+/g, '-').replace(/^-/g, '').replace(/-$/g, '');
162
- }
163
- /**
164
- * @param {number} number
165
- * @return {string}
166
- */
167
-
168
- function pad2(number) {
169
- if (number < 10) {
170
- return '0' + number;
171
- }
172
-
173
- return String(number);
174
- }
175
- /**
176
- * @param {number} number
177
- * @return {string}
178
- */
179
-
180
- function pad4(number) {
181
- if (number < 0) {
182
- return '-00' + pad4(-number);
183
- } else if (number < 10) {
184
- return '000' + number;
185
- } else if (number < 100) {
186
- return '00' + number;
187
- } else if (number < 1000) {
188
- return '0' + number;
189
- }
190
-
191
- return String(number);
192
- }
193
- /**
194
- * Returns a category and subcategory name
195
- * @param {Event} ev
196
- * @return {string[]}
197
- */
198
-
199
- function getEventCategories(ev) {
200
- const desc = ev.getDesc(); // since these use flags.MINOR_FAST or flags.MAJOR_FAST, check description first
201
-
202
- if (desc === 'Fast begins' || desc === 'Fast ends') {
203
- return ['zmanim', 'fast'];
204
- }
205
-
206
- switch (ev.getFlags()) {
207
- case flags.OMER_COUNT:
208
- return ['omer'];
209
-
210
- case flags.HEBREW_DATE:
211
- return ['hebdate'];
212
-
213
- case flags.PARSHA_HASHAVUA:
214
- return ['parashat'];
215
- // backwards-compat
216
-
217
- case flags.DAF_YOMI:
218
- return ['dafyomi'];
219
-
220
- case flags.ROSH_CHODESH:
221
- return ['roshchodesh'];
222
-
223
- case flags.SPECIAL_SHABBAT:
224
- return ['holiday', 'shabbat'];
225
-
226
- case flags.MINOR_FAST:
227
- return ['holiday', 'fast'];
228
-
229
- case flags.MAJOR_FAST:
230
- return ['holiday', 'fast', 'major'];
231
-
232
- case flags.MODERN_HOLIDAY:
233
- return ['holiday', 'modern'];
234
-
235
- case flags.SHABBAT_MEVARCHIM:
236
- return ['mevarchim'];
237
-
238
- case flags.MOLAD:
239
- return ['molad'];
240
-
241
- case flags.USER_EVENT:
242
- return ['user'];
243
-
244
- case flags.MINOR_HOLIDAY:
245
- return ['holiday', 'minor'];
246
- // fall through to string-based category
247
- }
248
-
249
- if (ev.cholHaMoedDay) {
250
- return ['holiday', 'major', 'cholhamoed'];
251
- }
252
-
253
- switch (desc) {
254
- case 'Havdalah':
255
- return ['havdalah'];
256
-
257
- case 'Candle lighting':
258
- return ['candles'];
259
-
260
- case 'Lag BaOmer':
261
- case 'Leil Selichot':
262
- case 'Pesach Sheni':
263
- case 'Erev Purim':
264
- case 'Purim Katan':
265
- case 'Shushan Purim':
266
- case 'Tu B\'Av':
267
- case 'Tu BiShvat':
268
- case 'Rosh Hashana LaBehemot':
269
- return ['holiday', 'minor'];
270
-
271
- case 'Erev Tish\'a B\'Av':
272
- return ['holiday', 'fast', 'major'];
273
-
274
- default:
275
- return ['holiday', 'major'];
276
- }
277
- }
278
- /**
279
- * Generates a title like "Hebcal 2020 Israel" or "Hebcal May 1993 Providence"
280
- * @param {Event[]} events
281
- * @param {HebrewCalendar.Options} options
282
- * @return {string}
283
- */
284
-
285
- function getCalendarTitle(events, options) {
286
- let title = 'Hebcal';
287
- const location = options.location;
288
-
289
- if (options.yahrzeit) {
290
- title += ' Yahrzeits and Anniversaries';
291
- } else if (location && location.name) {
292
- const comma = location.name.indexOf(',');
293
- const name = comma == -1 ? location.name : location.name.substring(0, comma);
294
- title += ' ' + name;
295
- } else if (options.il) {
296
- title += ' Israel';
297
- } else {
298
- title += ' Diaspora';
299
- }
300
-
301
- if (options.isHebrewYear || events.length == 0) {
302
- title += ' ' + options.year;
303
- } else {
304
- const start = events[0].getDate().greg();
305
- const end = events[events.length - 1].getDate().greg();
306
-
307
- if (start.getFullYear() != end.getFullYear()) {
308
- title += ' ' + start.getFullYear() + '-' + end.getFullYear();
309
- } else if (start.getMonth() == end.getMonth()) {
310
- const monthFormat = new Intl.DateTimeFormat('en-US', {
311
- month: 'long'
312
- });
313
- const startMonth = monthFormat.format(start);
314
- title += ' ' + startMonth + ' ' + start.getFullYear();
315
- } else {
316
- title += ' ' + start.getFullYear();
317
- }
318
- }
319
-
320
- return title;
321
- }
322
- /**
323
- * Returns an English language description of the holiday
324
- * @param {Event} ev
325
- * @param {boolean} [firstSentence=false]
326
- * @return {string}
327
- */
328
-
329
- function getHolidayDescription(ev, firstSentence = false) {
330
- const str = holidayDescription[ev.getDesc()] || holidayDescription[ev.basename()] || '';
331
-
332
- if (firstSentence && str) {
333
- const dot = str.indexOf('.');
334
-
335
- if (dot != -1) {
336
- return str.substring(0, dot);
337
- }
338
- }
339
-
340
- return str;
341
- }
342
- const HOLIDAY_IGNORE_MASK$1 = flags.DAF_YOMI | flags.OMER_COUNT | flags.SHABBAT_MEVARCHIM | flags.MOLAD | flags.USER_EVENT | flags.HEBREW_DATE;
343
- /**
344
- * Makes mulit-line text that summarizes Torah & Haftarah
345
- * @param {Event} ev
346
- * @param {boolean} il
347
- * @return {string}
348
- */
349
-
350
- function makeTorahMemoText(ev, il) {
351
- const mask = ev.getFlags();
352
-
353
- if (mask & HOLIDAY_IGNORE_MASK$1) {
354
- return '';
355
- }
356
-
357
- const reading = mask & flags.PARSHA_HASHAVUA ? leyn.getLeyningForParshaHaShavua(ev, il) : leyn.getLeyningForHoliday(ev, il);
358
- let memo = '';
359
-
360
- if (reading && (reading.summary || reading.haftara)) {
361
- if (reading.summary) {
362
- memo += `Torah: ${reading.summary}`;
363
- }
364
-
365
- if (reading.summary && reading.haftara) {
366
- memo += '\n';
367
- }
368
-
369
- if (reading.haftara) {
370
- memo += 'Haftarah: ' + reading.haftara;
371
-
372
- if (reading.reason && reading.reason.haftara) {
373
- memo += ' | ' + reading.reason.haftara;
374
- }
375
- }
376
- }
377
-
378
- if (reading && reading.sephardic) {
379
- memo += '\nHaftarah for Sephardim: ' + reading.sephardic;
380
- }
381
-
382
- return memo;
383
- }
384
- /**
385
- * Appends utm_source and utm_medium parameters to a URL
386
- * @param {string} url
387
- * @param {boolean} il
388
- * @param {string} utmSource
389
- * @param {string} utmMedium
390
- * @param {string} utmCampaign
391
- * @return {string}
392
- */
393
-
394
- function appendIsraelAndTracking(url, il, utmSource, utmMedium, utmCampaign) {
395
- if (url.substring(0, 22) !== 'https://www.hebcal.com') {
396
- utmSource = 'hebcal.com';
397
- } else if (il && url.indexOf('?') === -1) {
398
- url += '?i=on';
399
- }
400
-
401
- const sep = url.indexOf('?') === -1 ? '?' : '&';
402
- const utm = `utm_source=${utmSource}&utm_medium=${utmMedium}`;
403
- const campaign = utmCampaign ? `&utm_campaign=${utmCampaign}` : '';
404
- return url + sep + utm + campaign;
405
- }
406
- /**
407
- * @private
408
- * @param {Event} ev
409
- * @return {boolean}
410
- */
411
-
412
- function shouldRenderBrief(ev) {
413
- if (typeof ev.eventTime !== 'undefined') return true;
414
- const mask = ev.getFlags();
415
-
416
- if (mask & flags.HEBREW_DATE) {
417
- const hd = ev.getDate();
418
- return hd.getDate() === 1 ? false : true;
419
- } else if (mask & flags.DAF_YOMI) {
420
- return true;
421
- } else {
422
- return false;
423
- }
424
- }
425
-
426
- var version="4.14.4";
7
+ var version="4.15.2";
427
8
 
428
9
  const VTIMEZONE = {};
429
10
  const CATEGORY = {
430
11
  candles: 'Holiday',
431
12
  dafyomi: 'Daf Yomi',
13
+ mishnayomi: 'Mishna Yomi',
432
14
  havdalah: 'Holiday',
433
15
  hebdate: null,
434
16
  holiday: 'Holiday',
@@ -497,6 +79,8 @@ class IcalEvent {
497
79
  this.locationName = ev.locationName;
498
80
  } else if (mask & flags.DAF_YOMI) {
499
81
  this.locationName = Locale.gettext('Daf Yomi');
82
+ } else if (mask & flags.MISHNA_YOMI) {
83
+ this.locationName = Locale.gettext('Mishna Yomi');
500
84
  } else if (timed && options.location && options.location.name) {
501
85
  const comma = options.location.name.indexOf(',');
502
86
  this.locationName = comma == -1 ? options.location.name : options.location.name.substring(0, comma);
@@ -566,14 +150,13 @@ class IcalEvent {
566
150
  this.category = ev.category || CATEGORY[getEventCategories(ev)[0]];
567
151
  }
568
152
  /**
569
- * @private
570
153
  * @return {string}
571
154
  */
572
155
 
573
156
 
574
157
  getUid() {
575
158
  const options = this.options;
576
- const digest = murmur3_1(this.ev.getDesc()).toString(16);
159
+ const digest = murmur32HexSync(this.ev.getDesc());
577
160
  let uid = `hebcal-${this.startDate}-${digest}`;
578
161
 
579
162
  if (this.timed && options.location) {
@@ -750,7 +333,7 @@ function eventToIcal(ev, options) {
750
333
  return ical.toString();
751
334
  }
752
335
  const torahMemoCache = new Map();
753
- const HOLIDAY_IGNORE_MASK = flags.DAF_YOMI | flags.OMER_COUNT | flags.SHABBAT_MEVARCHIM | flags.MOLAD | flags.USER_EVENT | flags.HEBREW_DATE;
336
+ const HOLIDAY_IGNORE_MASK = flags.DAF_YOMI | flags.OMER_COUNT | flags.SHABBAT_MEVARCHIM | flags.MOLAD | flags.USER_EVENT | flags.MISHNA_YOMI | flags.HEBREW_DATE;
754
337
  /**
755
338
  * @private
756
339
  * @param {Event} ev
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/icalendar",
3
- "version": "4.14.4",
3
+ "version": "4.15.2",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "keywords": [
6
6
  "ical",
@@ -24,8 +24,9 @@
24
24
  "url": "https://github.com/hebcal/hebcal-icalendar/issues"
25
25
  },
26
26
  "dependencies": {
27
- "@hebcal/core": "^3.27.0",
28
- "@hebcal/rest-api": "^3.8.6"
27
+ "@hebcal/core": "^3.33.2",
28
+ "@hebcal/rest-api": "^3.12.0",
29
+ "murmurhash3": "^0.5.0"
29
30
  },
30
31
  "scripts": {
31
32
  "build": "rollup -c",
@@ -43,31 +44,22 @@
43
44
  "@babel/register",
44
45
  "regenerator-runtime/runtime"
45
46
  ],
46
- "babel": {
47
- "testOptions": {
48
- "presets": [
49
- "@babel/env"
50
- ]
51
- }
52
- },
53
47
  "inherit": true,
54
48
  "verbose": true
55
49
  },
56
50
  "devDependencies": {
57
- "@ava/babel": "^2.0.0",
58
- "@babel/core": "^7.15.8",
59
- "@babel/preset-env": "^7.15.8",
60
- "@babel/register": "^7.14.5",
51
+ "@babel/core": "^7.17.3",
52
+ "@babel/preset-env": "^7.16.11",
53
+ "@babel/register": "^7.17.0",
61
54
  "@rollup/plugin-babel": "^5.3.0",
62
- "@rollup/plugin-commonjs": "^20.0.0",
55
+ "@rollup/plugin-commonjs": "^21.0.1",
63
56
  "@rollup/plugin-json": "^4.1.0",
64
- "@rollup/plugin-node-resolve": "^13.0.6",
65
- "ava": "^3.15.0",
66
- "eslint": "^7.32.0",
57
+ "@rollup/plugin-node-resolve": "^13.1.3",
58
+ "ava": "^4.0.1",
59
+ "eslint": "^8.9.0",
67
60
  "eslint-config-google": "^0.14.0",
68
- "jsdoc": "^3.6.7",
69
- "jsdoc-to-markdown": "^7.1.0",
70
- "murmurhash-js": "^1.0.0",
71
- "rollup": "^2.58.0"
61
+ "jsdoc": "^3.6.10",
62
+ "jsdoc-to-markdown": "^7.1.1",
63
+ "rollup": "^2.67.2"
72
64
  }
73
65
  }