@hebcal/core 6.5.1 → 6.5.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 (118) hide show
  1. package/dist/bundle.js +5929 -5384
  2. package/dist/bundle.js.map +1 -1
  3. package/dist/bundle.min.js +17 -17
  4. package/dist/bundle.min.js.map +1 -1
  5. package/dist/esm/CalOptions.d.ts +3 -4
  6. package/dist/esm/DailyLearning.d.ts +44 -7
  7. package/dist/esm/DailyLearning.js +45 -8
  8. package/dist/esm/DailyLearning.js.map +1 -1
  9. package/dist/esm/HebrewDateEvent.js +1 -1
  10. package/dist/esm/HolidayEvent.d.ts +34 -1
  11. package/dist/esm/HolidayEvent.js +35 -2
  12. package/dist/esm/HolidayEvent.js.map +1 -1
  13. package/dist/esm/MevarchimChodeshEvent.js +1 -1
  14. package/dist/esm/ParshaEvent.js +1 -1
  15. package/dist/esm/TimedEvent.d.ts +32 -3
  16. package/dist/esm/TimedEvent.js +33 -4
  17. package/dist/esm/TimedEvent.js.map +1 -1
  18. package/dist/esm/YomKippurKatanEvent.js +1 -1
  19. package/dist/esm/ashkenazi.po.js +1 -1
  20. package/dist/esm/calendar.js +1 -1
  21. package/dist/esm/candles.d.ts +14 -1
  22. package/dist/esm/candles.js +15 -2
  23. package/dist/esm/candles.js.map +1 -1
  24. package/dist/esm/cities.json.js +1 -1
  25. package/dist/esm/event.d.ts +56 -13
  26. package/dist/esm/event.js +57 -14
  27. package/dist/esm/event.js.map +1 -1
  28. package/dist/esm/getStartAndEnd.js +10 -2
  29. package/dist/esm/getStartAndEnd.js.map +1 -1
  30. package/dist/esm/hallel.js +20 -28
  31. package/dist/esm/hallel.js.map +1 -1
  32. package/dist/esm/he-x-NoNikud.po.js +1 -1
  33. package/dist/esm/he.po.js +1 -1
  34. package/dist/esm/hebcal.d.ts +97 -19
  35. package/dist/esm/hebcal.js +102 -21
  36. package/dist/esm/hebcal.js.map +1 -1
  37. package/dist/esm/holidays.d.ts +21 -2
  38. package/dist/esm/holidays.js +22 -3
  39. package/dist/esm/holidays.js.map +1 -1
  40. package/dist/esm/index.d.ts +1 -1
  41. package/dist/esm/index.js +2 -1
  42. package/dist/esm/index.js.map +1 -1
  43. package/dist/esm/isAssurBemlacha.d.ts +24 -4
  44. package/dist/esm/isAssurBemlacha.js +25 -5
  45. package/dist/esm/isAssurBemlacha.js.map +1 -1
  46. package/dist/esm/isAveilut.d.ts +14 -3
  47. package/dist/esm/isAveilut.js +15 -4
  48. package/dist/esm/isAveilut.js.map +1 -1
  49. package/dist/esm/isFastDay.d.ts +13 -1
  50. package/dist/esm/isFastDay.js +14 -2
  51. package/dist/esm/isFastDay.js.map +1 -1
  52. package/dist/esm/locale.js +1 -1
  53. package/dist/esm/location.d.ts +96 -8
  54. package/dist/esm/location.js +101 -10
  55. package/dist/esm/location.js.map +1 -1
  56. package/dist/esm/modern.js +1 -1
  57. package/dist/esm/molad.d.ts +39 -7
  58. package/dist/esm/molad.js +40 -8
  59. package/dist/esm/molad.js.map +1 -1
  60. package/dist/esm/moladBase.js +1 -1
  61. package/dist/esm/moladDate.js +1 -1
  62. package/dist/esm/omer.d.ts +32 -4
  63. package/dist/esm/omer.js +33 -5
  64. package/dist/esm/omer.js.map +1 -1
  65. package/dist/esm/parshaName.js +1 -1
  66. package/dist/esm/parshaYear.d.ts +12 -1
  67. package/dist/esm/parshaYear.js +13 -2
  68. package/dist/esm/parshaYear.js.map +1 -1
  69. package/dist/esm/pkgVersion.d.ts +1 -1
  70. package/dist/esm/pkgVersion.js +2 -2
  71. package/dist/esm/pkgVersion.js.map +1 -1
  72. package/dist/esm/reformatTimeStr.js +1 -1
  73. package/dist/esm/sedra.d.ts +94 -14
  74. package/dist/esm/sedra.js +95 -15
  75. package/dist/esm/sedra.js.map +1 -1
  76. package/dist/esm/sefira.json.js +1 -1
  77. package/dist/esm/staticHolidays.js +1 -1
  78. package/dist/esm/tachanun.js +1 -1
  79. package/dist/esm/temporal-shim.js +1 -1
  80. package/dist/esm/zmanim.js +1 -1
  81. package/dist/src/CalOptions.d.ts +3 -4
  82. package/dist/src/DailyLearning.d.ts +44 -7
  83. package/dist/src/DailyLearning.js +44 -7
  84. package/dist/src/HolidayEvent.d.ts +34 -1
  85. package/dist/src/HolidayEvent.js +34 -1
  86. package/dist/src/TimedEvent.d.ts +32 -3
  87. package/dist/src/TimedEvent.js +32 -3
  88. package/dist/src/candles.d.ts +14 -1
  89. package/dist/src/candles.js +14 -1
  90. package/dist/src/event.d.ts +56 -13
  91. package/dist/src/event.js +56 -13
  92. package/dist/src/getStartAndEnd.js +9 -1
  93. package/dist/src/hallel.js +19 -27
  94. package/dist/src/hebcal.d.ts +97 -19
  95. package/dist/src/hebcal.js +101 -20
  96. package/dist/src/holidays.d.ts +21 -2
  97. package/dist/src/holidays.js +21 -2
  98. package/dist/src/index.d.ts +1 -1
  99. package/dist/src/index.js +1 -0
  100. package/dist/src/isAssurBemlacha.d.ts +24 -4
  101. package/dist/src/isAssurBemlacha.js +24 -4
  102. package/dist/src/isAveilut.d.ts +14 -3
  103. package/dist/src/isAveilut.js +14 -3
  104. package/dist/src/isFastDay.d.ts +13 -1
  105. package/dist/src/isFastDay.js +13 -1
  106. package/dist/src/location.d.ts +96 -8
  107. package/dist/src/location.js +100 -9
  108. package/dist/src/molad.d.ts +39 -7
  109. package/dist/src/molad.js +39 -7
  110. package/dist/src/omer.d.ts +32 -4
  111. package/dist/src/omer.js +32 -4
  112. package/dist/src/parshaYear.d.ts +12 -1
  113. package/dist/src/parshaYear.js +12 -1
  114. package/dist/src/pkgVersion.d.ts +1 -1
  115. package/dist/src/pkgVersion.js +1 -1
  116. package/dist/src/sedra.d.ts +94 -14
  117. package/dist/src/sedra.js +94 -14
  118. package/package.json +5 -5
package/dist/esm/omer.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.5.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.5.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { Locale, gematriya } from '@hebcal/hdate';
3
3
  import { Event, flags } from './event.js';
4
4
  import './locale.js';
@@ -190,14 +190,33 @@ const anaBekoach = sefira.anaBekoach;
190
190
  const ps67lines = sefira.ps67lines;
191
191
  const lamnatzeach = ps67lines.flatMap((x) => x.split(/[ ־]/));
192
192
  const lamnatzeachLetters = sefira.lamnatzeachLetters.split('');
193
- /** Represents a day 1-49 of counting the Omer from Pesach to Shavuot */
193
+ /**
194
+ * Represents one of the 49 days of counting the Omer between Pesach and
195
+ * Shavuot (16 Nisan through 5 Sivan).
196
+ *
197
+ * Each day has an associated Sefirah pairing (e.g. *Chesed shebiGevurah*),
198
+ * a word from Psalm 67 (Lamnatzeach), a letter from verse 5 of Psalm 67,
199
+ * and a word/acrostic from the Ana BeKoach prayer — all accessible via
200
+ * the methods on this class.
201
+ *
202
+ * @example
203
+ * import {OmerEvent, HDate, months} from '@hebcal/core';
204
+ * const ev = new OmerEvent(new HDate(16, months.NISAN, 5784), 1);
205
+ * ev.render('en'); // '1st day of the Omer'
206
+ * ev.render('he'); // 'א׳ בָּעוֹמֶר'
207
+ * ev.sefira('translit'); // 'Chesed shebChesed'
208
+ * ev.getTodayIs('en'); // 'Today is 1 day of the Omer'
209
+ */
194
210
  class OmerEvent extends Event {
195
211
  weekNumber;
196
212
  daysWithinWeeks;
197
213
  omer;
198
214
  /**
199
- * @param date
200
- * @param omerDay
215
+ * Constructs an Omer event for a given day (1–49).
216
+ *
217
+ * Throws `RangeError` if `omerDay` is outside 1–49.
218
+ * @param date Hebrew date this Omer day is counted on (the evening of)
219
+ * @param omerDay day of the Omer, 1 through 49
201
220
  */
202
221
  constructor(date, omerDay) {
203
222
  super(date, `Omer ${omerDay}`, flags.OMER_COUNT);
@@ -207,10 +226,19 @@ class OmerEvent extends Event {
207
226
  this.omer = omerDay;
208
227
  }
209
228
  /**
210
- * Returns the sefira. For example, on day 8:
229
+ * Returns the Sefirah pairing associated with this Omer day
230
+ * one of the seven lower Sefirot within another, calculated as
231
+ * `day-within-week` of `week-within-cycle`. For example, on day 8
232
+ * (week 2, day 1):
211
233
  * * חֶֽסֶד שֶׁבִּגְבוּרָה
212
234
  * * Chesed shebiGevurah
213
235
  * * Lovingkindness within Might
236
+ * @example
237
+ * import {OmerEvent, HDate, months} from '@hebcal/core';
238
+ * const day8 = new OmerEvent(new HDate(23, months.NISAN, 5784), 8);
239
+ * day8.sefira('en'); // 'Lovingkindness within Might'
240
+ * day8.sefira('he'); // 'חֶֽסֶד שֶׁבִּגְבוּרָה'
241
+ * day8.sefira('translit'); // 'Chesed shebiGevurah'
214
242
  * @param lang `en` (English), `he` (Hebrew with nikud), or `translit` (Hebrew in Sephardic transliteration)
215
243
  * @returns a string such as `Lovingkindness within Might` or `חֶֽסֶד שֶׁבִּגְבוּרָה`
216
244
  */
@@ -1 +1 @@
1
- {"version":3,"file":"omer.js","sources":["../../../src/omer.ts"],"sourcesContent":["import {HDate, Locale, gematriya} from '@hebcal/hdate';\nimport {Event, flags} from './event';\nimport './locale'; // Adds Hebrew and Ashkenazic translations\nimport sefira from './sefira.json';\n\n/**\n * Language for counting the Omer can be English or Hebrew.\n * Lang for the Sefira can be English, Hebrew, or Hebrew in Sephardic transliteration.\n */\nexport type OmerLang = 'en' | 'he' | 'translit';\n\nconst sefirot = {\n en: {\n infix: 'within ',\n infix26: 'within ',\n words: [\n '',\n 'Lovingkindness',\n 'Might',\n 'Beauty',\n 'Eternity',\n 'Splendor',\n 'Foundation',\n 'Majesty',\n ],\n pfxWords: null,\n },\n he: {\n infix: null,\n infix26: null,\n words: [\n '',\n 'חֶֽסֶד',\n 'גְּבוּרָה',\n 'תִּפְאֶֽרֶת',\n 'נֶּֽצַח',\n 'הוֹד',\n 'יְּסוֹד',\n 'מַלְכוּת',\n ],\n pfxWords: [\n '',\n 'שֶׁבְּחֶֽסֶד',\n 'שֶׁבִּגְבוּרָה',\n 'שֶׁבְּתִפְאֶֽרֶת',\n 'שֶׁבְּנֶֽצַח',\n 'שֶׁבְּהוֹד',\n 'שֶׁבִּיְסוֹד',\n 'שֶׁבְּמַלְכוּת',\n ],\n },\n translit: {\n infix: \"sheb'\",\n infix26: 'shebi',\n words: [\n '',\n 'Chesed',\n 'Gevurah',\n 'Tiferet',\n 'Netzach',\n 'Hod',\n 'Yesod',\n 'Malkhut',\n ],\n pfxWords: null,\n },\n} as const;\n\nfunction checkDay(omerDay: number): void {\n if (omerDay < 1 || omerDay > 49) {\n throw new RangeError(`Invalid Omer day ${omerDay}`);\n }\n}\n\nfunction getWeeks(omerDay: number): number[] {\n const weekNum: number = Math.floor((omerDay - 1) / 7) + 1;\n const daysWithinWeeks: number = omerDay % 7 || 7;\n return [weekNum, daysWithinWeeks];\n}\n\nfunction omerTodayIsEn(omerDay: number): string {\n const [weekNumber, daysWithinWeeks]: number[] = getWeeks(omerDay);\n\n const totalDaysStr: string = omerDay === 1 ? 'day' : 'days';\n let str = `Today is ${omerDay} ${totalDaysStr}`;\n\n if (weekNumber > 1 || omerDay === 7) {\n const day7: boolean = daysWithinWeeks === 7;\n const numWeeks: number = day7 ? weekNumber : weekNumber - 1;\n const weeksStr: string = numWeeks === 1 ? 'week' : 'weeks';\n str += `, which are ${numWeeks} ${weeksStr}`;\n if (!day7) {\n const daysStr: string = daysWithinWeeks === 1 ? 'day' : 'days';\n str += ` and ${daysWithinWeeks} ${daysStr}`;\n }\n }\n return str + ' of the Omer';\n}\n\n// adapted from pip hdate package (GPL)\n// https://github.com/py-libhdate/py-libhdate/blob/master/hdate/date.py\n\nconst tens = ['', 'עֲשָׂרָה', 'עֶשְׂרִים', 'שְׁלוֹשִׁים', 'אַרְבָּעִים'];\nconst ones = [\n '',\n 'אֶחָד',\n 'שְׁנַיִם',\n 'שְׁלוֹשָׁה',\n 'אַרְבָּעָה',\n 'חֲמִשָּׁה',\n 'שִׁשָּׁה',\n 'שִׁבְעָה',\n 'שְׁמוֹנָה',\n 'תִּשְׁעָה',\n];\n\nconst shnei = 'שְׁנֵי';\nconst yamim = 'יָמִים';\nconst shneiYamim = shnei + ' ' + yamim;\nconst shavuot = 'שָׁבוּעוֹת';\nconst yom = 'יוֹם';\nconst yomEchad = yom + ' ' + ones[1];\nconst asar = 'עָשָׂר';\n\nfunction omerTodayIsHe(omerDay: number): string {\n const ten: number = Math.floor(omerDay / 10);\n const one: number = omerDay % 10;\n let str = 'הַיּוֹם ';\n if (omerDay === 11) {\n str += 'אַחַד ' + asar;\n } else if (omerDay === 12) {\n str += 'שְׁנֵים ' + asar;\n } else if (12 < omerDay && omerDay < 20) {\n str += ones[one] + ' ' + asar;\n } else if (omerDay > 9) {\n str += ones[one];\n if (one) {\n str += ' ';\n str += ten === 3 ? 'וּ' : 'וְ';\n }\n }\n if (omerDay > 2) {\n if (omerDay > 20 || omerDay === 10 || omerDay === 20) {\n str += tens[ten];\n }\n if (omerDay < 11) {\n str += ones[one] + ' ' + yamim + ' ';\n } else {\n str += ' ' + yom + ' ';\n }\n } else if (omerDay === 1) {\n str += yomEchad + ' ';\n } else {\n // omer == 2\n str += shneiYamim + ' ';\n }\n if (omerDay > 6) {\n str = str.trim(); // remove trailing space before comma\n str += ', שֶׁהֵם ';\n const weeks: number = Math.floor(omerDay / 7);\n const days: number = omerDay % 7;\n if (weeks > 2) {\n str += ones[weeks] + ' ' + shavuot + ' ';\n } else if (weeks === 1) {\n str += 'שָׁבֽוּעַ' + ' ' + ones[1] + ' ';\n } else {\n // weeks == 2\n str += shnei + ' ' + shavuot + ' ';\n }\n if (days) {\n if (days === 2 || days === 3) {\n str += 'וּ';\n } else if (days === 5) {\n str += 'וַ';\n } else {\n str += 'וְ';\n }\n if (days > 2) {\n str += ones[days] + ' ' + yamim + ' ';\n } else if (days === 1) {\n str += yomEchad + ' ';\n } else {\n // days == 2\n str += shneiYamim + ' ';\n }\n }\n }\n str += 'לָעֽוֹמֶר';\n return str.normalize();\n}\n\nconst anaBekoach = sefira.anaBekoach;\n\nconst ps67lines = sefira.ps67lines;\n\nconst lamnatzeach = ps67lines.flatMap((x: string) => x.split(/[ ־]/));\n\nconst lamnatzeachLetters = sefira.lamnatzeachLetters.split('');\n\n/** Represents a day 1-49 of counting the Omer from Pesach to Shavuot */\nexport class OmerEvent extends Event {\n private readonly weekNumber: number;\n private readonly daysWithinWeeks: number;\n readonly omer: number;\n\n /**\n * @param date\n * @param omerDay\n */\n constructor(date: HDate, omerDay: number) {\n super(date, `Omer ${omerDay}`, flags.OMER_COUNT);\n checkDay(omerDay);\n this.weekNumber = Math.floor((omerDay - 1) / 7) + 1;\n this.daysWithinWeeks = omerDay % 7 || 7;\n this.omer = omerDay;\n }\n\n /**\n * Returns the sefira. For example, on day 8:\n * * חֶֽסֶד שֶׁבִּגְבוּרָה\n * * Chesed shebiGevurah\n * * Lovingkindness within Might\n * @param lang `en` (English), `he` (Hebrew with nikud), or `translit` (Hebrew in Sephardic transliteration)\n * @returns a string such as `Lovingkindness within Might` or `חֶֽסֶד שֶׁבִּגְבוּרָה`\n */\n sefira(lang: OmerLang = 'en'): string {\n if (lang !== 'he' && lang !== 'translit') {\n lang = 'en';\n }\n const [weekNum, daysWithinWeeks]: number[] = getWeeks(this.omer);\n const config = sefirot[lang as OmerLang];\n const pfxWords = config.pfxWords;\n const words = config.words;\n const week = pfxWords ? pfxWords[weekNum] : words[weekNum];\n const dayWithinWeek = words[daysWithinWeeks];\n const infix = pfxWords\n ? ''\n : weekNum === 2 || weekNum === 6\n ? config.infix26\n : config.infix;\n return (dayWithinWeek + ' ' + infix + week).normalize();\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n render(locale?: string): string {\n const isHebrewLocale = Locale.isHebrewLocale(locale);\n const omer = this.omer;\n const nth = isHebrewLocale ? gematriya(omer) : Locale.ordinal(omer, locale);\n return nth + ' ' + Locale.gettext('day of the Omer', locale);\n }\n /**\n * Returns translation of \"Omer day 22\" without ordinal numbers.\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n renderBrief(locale?: string): string {\n return (\n Locale.gettext('Omer', locale) +\n ' ' +\n Locale.gettext('day', locale) +\n ' ' +\n this.omer\n );\n }\n /**\n * Returns an emoji number symbol with a circle, for example `㊲`\n * from the “Enclosed CJK Letters and Months” block of the Unicode standard\n * @returns a single Unicode character from `①` through `㊾`\n */\n getEmoji(): string {\n if (typeof this.emoji === 'string') return this.emoji;\n let codePoint: number;\n const omerDay = this.omer;\n if (omerDay <= 20) {\n codePoint = 9312 + omerDay - 1;\n } else if (omerDay <= 35) {\n // between 21 and 35 inclusive\n codePoint = 12881 + omerDay - 21;\n } else {\n // between 36 and 49 inclusive\n codePoint = 12977 + omerDay - 36;\n }\n return String.fromCodePoint(codePoint);\n }\n\n getWeeks(): number {\n const day7 = this.daysWithinWeeks === 7;\n return day7 ? this.weekNumber : this.weekNumber - 1;\n }\n\n getDaysWithinWeeks(): number {\n return this.daysWithinWeeks;\n }\n /**\n * Returns a sentence with that evening's omer count\n * @returns a string such as `Today is 10 days, which is 1 week and 3 days of the Omer`\n * or `הַיוֹם עֲשָׂרָה יָמִים, שְׁהֵם שָׁבוּעַ אֶחָד וְשְׁלוֹשָׁה יָמִים לָעוֹמֶר`\n */\n getTodayIs(locale: string): string {\n locale = (locale || 'en').toLowerCase();\n const isHebrew = Locale.isHebrewLocale(locale);\n const str = isHebrew ? omerTodayIsHe(this.omer) : omerTodayIsEn(this.omer);\n if (locale === 'he-x-nonikud') {\n return Locale.hebrewStripNikkud(str);\n }\n return str;\n }\n\n url(): string | undefined {\n const year = this.getDate().getFullYear();\n if (year < 5000 || year > 6759) {\n return undefined;\n }\n return `https://www.hebcal.com/omer/${year}/${this.omer}`;\n }\n\n /**\n * Returns the word from Psalm 67 (לַמְנַצֵּחַ, \"Lamnatzeach\") corresponding\n * to this Omer day. Psalm 67 contains 49 words (excluding its opening verse),\n * one for each day of the Omer. The words are taken from verses 2–8, split on\n * spaces and maqef (־).\n * @returns a Hebrew word from Psalm 67\n * @example\n * const ev = new OmerEvent(new HDate(16, 'Nisan', 5785), 1);\n * ev.getLamnatzeachWord(); // 'אֱלֹהִים' (day 1, first word of verse 2)\n * @example\n * const ev = new OmerEvent(new HDate(3, 'Sivan', 5785), 49);\n * ev.getLamnatzeachWord(); // 'אָרֶץ' (day 49, last word of verse 8)\n */\n getLamnatzeachWord(): string {\n return lamnatzeach[this.omer - 1];\n }\n\n /**\n * Returns the letter from verse 5 of Psalm 67 corresponding to this Omer day.\n * Verse 5 (יִשְׂמְחוּ וִירַנְּנוּ לְאֻמִּים…) contains exactly 49 letters,\n * one for each day of the Omer, and is used as a Kabbalistic meditation during\n * the counting.\n * @returns a single Hebrew letter from verse 5 of Psalm 67\n * @example\n * const ev = new OmerEvent(new HDate(16, 'Nisan', 5785), 1);\n * ev.getLamnatzeachLetter(); // 'י' (day 1, first letter of verse 5)\n * @example\n * const ev = new OmerEvent(new HDate(3, 'Sivan', 5785), 49);\n * ev.getLamnatzeachLetter(); // 'ה' (day 49, last letter of verse 5)\n */\n getLamnatzeachLetter(): string {\n return lamnatzeachLetters[this.omer - 1];\n }\n\n /**\n * Returns the word from the Ana BeKoach prayer (אָנָּא בְּכֹחַ) corresponding\n * to this Omer day. Ana BeKoach is a 42-word Kabbalistic prayer whose initial\n * letters spell out the 42-letter name of God. The prayer has 7 verses of\n * 6 words each; the 7th entry of each group is the abbreviation of the acrostic\n * letters for that verse (e.g. `אב״ג ית״ץ` for verse 1). Together the 49\n * entries (7 verses × 7 entries) align with the 49 days of the Omer, connecting\n * each day to one of the lower seven Sefirot within a Sefirah.\n * @returns a Hebrew word or verse-abbreviation string from Ana BeKoach\n * @example\n * const ev = new OmerEvent(new HDate(16, 'Nisan', 5785), 1);\n * ev.getAnaBekoachWord(); // 'אָנָּא' (day 1, first word of verse 1)\n * @example\n * const ev = new OmerEvent(new HDate(22, 'Nisan', 5785), 7);\n * ev.getAnaBekoachWord(); // 'אב״ג ית״ץ' (day 7, acrostic abbreviation for verse 1)\n * @example\n * const ev = new OmerEvent(new HDate(3, 'Sivan', 5785), 49);\n * ev.getAnaBekoachWord(); // 'שק״ו צי״ת' (day 49, acrostic abbreviation for verse 7)\n */\n getAnaBekoachWord(): string {\n return anaBekoach[this.omer - 1].normalize();\n }\n}\n"],"names":[],"mappings":";;;;;;AAWA,MAAM,OAAO,GAAG;AACd,IAAA,EAAE,EAAE;AACF,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,OAAO,EAAE,SAAS;AAClB,QAAA,KAAK,EAAE;YACL,EAAE;YACF,gBAAgB;YAChB,OAAO;YACP,QAAQ;YACR,UAAU;YACV,UAAU;YACV,YAAY;YACZ,SAAS;AACV,SAAA;AACD,QAAA,QAAQ,EAAE,IAAI;AACf,KAAA;AACD,IAAA,EAAE,EAAE;AACF,QAAA,KAAK,EAAE,IAAI;AACX,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,KAAK,EAAE;YACL,EAAE;YACF,QAAQ;YACR,WAAW;YACX,aAAa;YACb,SAAS;YACT,MAAM;YACN,SAAS;YACT,UAAU;AACX,SAAA;AACD,QAAA,QAAQ,EAAE;YACR,EAAE;YACF,cAAc;YACd,gBAAgB;YAChB,kBAAkB;YAClB,cAAc;YACd,YAAY;YACZ,cAAc;YACd,gBAAgB;AACjB,SAAA;AACF,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,KAAK,EAAE,OAAO;AACd,QAAA,OAAO,EAAE,OAAO;AAChB,QAAA,KAAK,EAAE;YACL,EAAE;YACF,QAAQ;YACR,SAAS;YACT,SAAS;YACT,SAAS;YACT,KAAK;YACL,OAAO;YACP,SAAS;AACV,SAAA;AACD,QAAA,QAAQ,EAAE,IAAI;AACf,KAAA;CACO;AAEV,SAAS,QAAQ,CAAC,OAAe,EAAA;IAC/B,IAAI,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,EAAE,EAAE;AAC/B,QAAA,MAAM,IAAI,UAAU,CAAC,oBAAoB,OAAO,CAAA,CAAE,CAAC;IACrD;AACF;AAEA,S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,EAAE;QACzC,IAAI,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,IAAI,EAAE;AAC9B,YAAA,OAAO,SAAS;QAClB;AACA,QAAA,OAAO,+BAA+B,IAAI,CAAA,CAAA,EAAI,IAAI,CAAC,IAAI,EAAE;IAC3D;AAEA;;;;;;;;;;;;AAYG;IACH,kBAAkB,GAAA;QAChB,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;IACnC;AAEA;;;;;;;;;;;;AAYG;IACH,oBAAoB,GAAA;QAClB,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;IAC1C;AAEA;;;;;;;;;;;;;;;;;;AAkBG;IACH,iBAAiB,GAAA;QACf,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE;IAC9C;AACD;;;;"}
1
+ {"version":3,"file":"omer.js","sources":["../../../src/omer.ts"],"sourcesContent":["import {HDate, Locale, gematriya} from '@hebcal/hdate';\nimport {Event, flags} from './event';\nimport './locale'; // Adds Hebrew and Ashkenazic translations\nimport sefira from './sefira.json';\n\n/**\n * Language for counting the Omer can be English or Hebrew.\n * Lang for the Sefira can be English, Hebrew, or Hebrew in Sephardic transliteration.\n */\nexport type OmerLang = 'en' | 'he' | 'translit';\n\nconst sefirot = {\n en: {\n infix: 'within ',\n infix26: 'within ',\n words: [\n '',\n 'Lovingkindness',\n 'Might',\n 'Beauty',\n 'Eternity',\n 'Splendor',\n 'Foundation',\n 'Majesty',\n ],\n pfxWords: null,\n },\n he: {\n infix: null,\n infix26: null,\n words: [\n '',\n 'חֶֽסֶד',\n 'גְּבוּרָה',\n 'תִּפְאֶֽרֶת',\n 'נֶּֽצַח',\n 'הוֹד',\n 'יְּסוֹד',\n 'מַלְכוּת',\n ],\n pfxWords: [\n '',\n 'שֶׁבְּחֶֽסֶד',\n 'שֶׁבִּגְבוּרָה',\n 'שֶׁבְּתִפְאֶֽרֶת',\n 'שֶׁבְּנֶֽצַח',\n 'שֶׁבְּהוֹד',\n 'שֶׁבִּיְסוֹד',\n 'שֶׁבְּמַלְכוּת',\n ],\n },\n translit: {\n infix: \"sheb'\",\n infix26: 'shebi',\n words: [\n '',\n 'Chesed',\n 'Gevurah',\n 'Tiferet',\n 'Netzach',\n 'Hod',\n 'Yesod',\n 'Malkhut',\n ],\n pfxWords: null,\n },\n} as const;\n\nfunction checkDay(omerDay: number): void {\n if (omerDay < 1 || omerDay > 49) {\n throw new RangeError(`Invalid Omer day ${omerDay}`);\n }\n}\n\nfunction getWeeks(omerDay: number): number[] {\n const weekNum: number = Math.floor((omerDay - 1) / 7) + 1;\n const daysWithinWeeks: number = omerDay % 7 || 7;\n return [weekNum, daysWithinWeeks];\n}\n\nfunction omerTodayIsEn(omerDay: number): string {\n const [weekNumber, daysWithinWeeks]: number[] = getWeeks(omerDay);\n\n const totalDaysStr: string = omerDay === 1 ? 'day' : 'days';\n let str = `Today is ${omerDay} ${totalDaysStr}`;\n\n if (weekNumber > 1 || omerDay === 7) {\n const day7: boolean = daysWithinWeeks === 7;\n const numWeeks: number = day7 ? weekNumber : weekNumber - 1;\n const weeksStr: string = numWeeks === 1 ? 'week' : 'weeks';\n str += `, which are ${numWeeks} ${weeksStr}`;\n if (!day7) {\n const daysStr: string = daysWithinWeeks === 1 ? 'day' : 'days';\n str += ` and ${daysWithinWeeks} ${daysStr}`;\n }\n }\n return str + ' of the Omer';\n}\n\n// adapted from pip hdate package (GPL)\n// https://github.com/py-libhdate/py-libhdate/blob/master/hdate/date.py\n\nconst tens = ['', 'עֲשָׂרָה', 'עֶשְׂרִים', 'שְׁלוֹשִׁים', 'אַרְבָּעִים'];\nconst ones = [\n '',\n 'אֶחָד',\n 'שְׁנַיִם',\n 'שְׁלוֹשָׁה',\n 'אַרְבָּעָה',\n 'חֲמִשָּׁה',\n 'שִׁשָּׁה',\n 'שִׁבְעָה',\n 'שְׁמוֹנָה',\n 'תִּשְׁעָה',\n];\n\nconst shnei = 'שְׁנֵי';\nconst yamim = 'יָמִים';\nconst shneiYamim = shnei + ' ' + yamim;\nconst shavuot = 'שָׁבוּעוֹת';\nconst yom = 'יוֹם';\nconst yomEchad = yom + ' ' + ones[1];\nconst asar = 'עָשָׂר';\n\nfunction omerTodayIsHe(omerDay: number): string {\n const ten: number = Math.floor(omerDay / 10);\n const one: number = omerDay % 10;\n let str = 'הַיּוֹם ';\n if (omerDay === 11) {\n str += 'אַחַד ' + asar;\n } else if (omerDay === 12) {\n str += 'שְׁנֵים ' + asar;\n } else if (12 < omerDay && omerDay < 20) {\n str += ones[one] + ' ' + asar;\n } else if (omerDay > 9) {\n str += ones[one];\n if (one) {\n str += ' ';\n str += ten === 3 ? 'וּ' : 'וְ';\n }\n }\n if (omerDay > 2) {\n if (omerDay > 20 || omerDay === 10 || omerDay === 20) {\n str += tens[ten];\n }\n if (omerDay < 11) {\n str += ones[one] + ' ' + yamim + ' ';\n } else {\n str += ' ' + yom + ' ';\n }\n } else if (omerDay === 1) {\n str += yomEchad + ' ';\n } else {\n // omer == 2\n str += shneiYamim + ' ';\n }\n if (omerDay > 6) {\n str = str.trim(); // remove trailing space before comma\n str += ', שֶׁהֵם ';\n const weeks: number = Math.floor(omerDay / 7);\n const days: number = omerDay % 7;\n if (weeks > 2) {\n str += ones[weeks] + ' ' + shavuot + ' ';\n } else if (weeks === 1) {\n str += 'שָׁבֽוּעַ' + ' ' + ones[1] + ' ';\n } else {\n // weeks == 2\n str += shnei + ' ' + shavuot + ' ';\n }\n if (days) {\n if (days === 2 || days === 3) {\n str += 'וּ';\n } else if (days === 5) {\n str += 'וַ';\n } else {\n str += 'וְ';\n }\n if (days > 2) {\n str += ones[days] + ' ' + yamim + ' ';\n } else if (days === 1) {\n str += yomEchad + ' ';\n } else {\n // days == 2\n str += shneiYamim + ' ';\n }\n }\n }\n str += 'לָעֽוֹמֶר';\n return str.normalize();\n}\n\nconst anaBekoach = sefira.anaBekoach;\n\nconst ps67lines = sefira.ps67lines;\n\nconst lamnatzeach = ps67lines.flatMap((x: string) => x.split(/[ ־]/));\n\nconst lamnatzeachLetters = sefira.lamnatzeachLetters.split('');\n\n/**\n * Represents one of the 49 days of counting the Omer between Pesach and\n * Shavuot (16 Nisan through 5 Sivan).\n *\n * Each day has an associated Sefirah pairing (e.g. *Chesed shebiGevurah*),\n * a word from Psalm 67 (Lamnatzeach), a letter from verse 5 of Psalm 67,\n * and a word/acrostic from the Ana BeKoach prayer — all accessible via\n * the methods on this class.\n *\n * @example\n * import {OmerEvent, HDate, months} from '@hebcal/core';\n * const ev = new OmerEvent(new HDate(16, months.NISAN, 5784), 1);\n * ev.render('en'); // '1st day of the Omer'\n * ev.render('he'); // 'א׳ בָּעוֹמֶר'\n * ev.sefira('translit'); // 'Chesed shebChesed'\n * ev.getTodayIs('en'); // 'Today is 1 day of the Omer'\n */\nexport class OmerEvent extends Event {\n private readonly weekNumber: number;\n private readonly daysWithinWeeks: number;\n readonly omer: number;\n\n /**\n * Constructs an Omer event for a given day (1–49).\n *\n * Throws `RangeError` if `omerDay` is outside 1–49.\n * @param date Hebrew date this Omer day is counted on (the evening of)\n * @param omerDay day of the Omer, 1 through 49\n */\n constructor(date: HDate, omerDay: number) {\n super(date, `Omer ${omerDay}`, flags.OMER_COUNT);\n checkDay(omerDay);\n this.weekNumber = Math.floor((omerDay - 1) / 7) + 1;\n this.daysWithinWeeks = omerDay % 7 || 7;\n this.omer = omerDay;\n }\n\n /**\n * Returns the Sefirah pairing associated with this Omer day —\n * one of the seven lower Sefirot within another, calculated as\n * `day-within-week` of `week-within-cycle`. For example, on day 8\n * (week 2, day 1):\n * * חֶֽסֶד שֶׁבִּגְבוּרָה\n * * Chesed shebiGevurah\n * * Lovingkindness within Might\n * @example\n * import {OmerEvent, HDate, months} from '@hebcal/core';\n * const day8 = new OmerEvent(new HDate(23, months.NISAN, 5784), 8);\n * day8.sefira('en'); // 'Lovingkindness within Might'\n * day8.sefira('he'); // 'חֶֽסֶד שֶׁבִּגְבוּרָה'\n * day8.sefira('translit'); // 'Chesed shebiGevurah'\n * @param lang `en` (English), `he` (Hebrew with nikud), or `translit` (Hebrew in Sephardic transliteration)\n * @returns a string such as `Lovingkindness within Might` or `חֶֽסֶד שֶׁבִּגְבוּרָה`\n */\n sefira(lang: OmerLang = 'en'): string {\n if (lang !== 'he' && lang !== 'translit') {\n lang = 'en';\n }\n const [weekNum, daysWithinWeeks]: number[] = getWeeks(this.omer);\n const config = sefirot[lang as OmerLang];\n const pfxWords = config.pfxWords;\n const words = config.words;\n const week = pfxWords ? pfxWords[weekNum] : words[weekNum];\n const dayWithinWeek = words[daysWithinWeeks];\n const infix = pfxWords\n ? ''\n : weekNum === 2 || weekNum === 6\n ? config.infix26\n : config.infix;\n return (dayWithinWeek + ' ' + infix + week).normalize();\n }\n /**\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n render(locale?: string): string {\n const isHebrewLocale = Locale.isHebrewLocale(locale);\n const omer = this.omer;\n const nth = isHebrewLocale ? gematriya(omer) : Locale.ordinal(omer, locale);\n return nth + ' ' + Locale.gettext('day of the Omer', locale);\n }\n /**\n * Returns translation of \"Omer day 22\" without ordinal numbers.\n * @param [locale] Optional locale name (defaults to empty locale)\n */\n renderBrief(locale?: string): string {\n return (\n Locale.gettext('Omer', locale) +\n ' ' +\n Locale.gettext('day', locale) +\n ' ' +\n this.omer\n );\n }\n /**\n * Returns an emoji number symbol with a circle, for example `㊲`\n * from the “Enclosed CJK Letters and Months” block of the Unicode standard\n * @returns a single Unicode character from `①` through `㊾`\n */\n getEmoji(): string {\n if (typeof this.emoji === 'string') return this.emoji;\n let codePoint: number;\n const omerDay = this.omer;\n if (omerDay <= 20) {\n codePoint = 9312 + omerDay - 1;\n } else if (omerDay <= 35) {\n // between 21 and 35 inclusive\n codePoint = 12881 + omerDay - 21;\n } else {\n // between 36 and 49 inclusive\n codePoint = 12977 + omerDay - 36;\n }\n return String.fromCodePoint(codePoint);\n }\n\n getWeeks(): number {\n const day7 = this.daysWithinWeeks === 7;\n return day7 ? this.weekNumber : this.weekNumber - 1;\n }\n\n getDaysWithinWeeks(): number {\n return this.daysWithinWeeks;\n }\n /**\n * Returns a sentence with that evening's omer count\n * @returns a string such as `Today is 10 days, which is 1 week and 3 days of the Omer`\n * or `הַיוֹם עֲשָׂרָה יָמִים, שְׁהֵם שָׁבוּעַ אֶחָד וְשְׁלוֹשָׁה יָמִים לָעוֹמֶר`\n */\n getTodayIs(locale: string): string {\n locale = (locale || 'en').toLowerCase();\n const isHebrew = Locale.isHebrewLocale(locale);\n const str = isHebrew ? omerTodayIsHe(this.omer) : omerTodayIsEn(this.omer);\n if (locale === 'he-x-nonikud') {\n return Locale.hebrewStripNikkud(str);\n }\n return str;\n }\n\n url(): string | undefined {\n const year = this.getDate().getFullYear();\n if (year < 5000 || year > 6759) {\n return undefined;\n }\n return `https://www.hebcal.com/omer/${year}/${this.omer}`;\n }\n\n /**\n * Returns the word from Psalm 67 (לַמְנַצֵּחַ, \"Lamnatzeach\") corresponding\n * to this Omer day. Psalm 67 contains 49 words (excluding its opening verse),\n * one for each day of the Omer. The words are taken from verses 2–8, split on\n * spaces and maqef (־).\n * @returns a Hebrew word from Psalm 67\n * @example\n * const ev = new OmerEvent(new HDate(16, 'Nisan', 5785), 1);\n * ev.getLamnatzeachWord(); // 'אֱלֹהִים' (day 1, first word of verse 2)\n * @example\n * const ev = new OmerEvent(new HDate(3, 'Sivan', 5785), 49);\n * ev.getLamnatzeachWord(); // 'אָרֶץ' (day 49, last word of verse 8)\n */\n getLamnatzeachWord(): string {\n return lamnatzeach[this.omer - 1];\n }\n\n /**\n * Returns the letter from verse 5 of Psalm 67 corresponding to this Omer day.\n * Verse 5 (יִשְׂמְחוּ וִירַנְּנוּ לְאֻמִּים…) contains exactly 49 letters,\n * one for each day of the Omer, and is used as a Kabbalistic meditation during\n * the counting.\n * @returns a single Hebrew letter from verse 5 of Psalm 67\n * @example\n * const ev = new OmerEvent(new HDate(16, 'Nisan', 5785), 1);\n * ev.getLamnatzeachLetter(); // 'י' (day 1, first letter of verse 5)\n * @example\n * const ev = new OmerEvent(new HDate(3, 'Sivan', 5785), 49);\n * ev.getLamnatzeachLetter(); // 'ה' (day 49, last letter of verse 5)\n */\n getLamnatzeachLetter(): string {\n return lamnatzeachLetters[this.omer - 1];\n }\n\n /**\n * Returns the word from the Ana BeKoach prayer (אָנָּא בְּכֹחַ) corresponding\n * to this Omer day. Ana BeKoach is a 42-word Kabbalistic prayer whose initial\n * letters spell out the 42-letter name of God. The prayer has 7 verses of\n * 6 words each; the 7th entry of each group is the abbreviation of the acrostic\n * letters for that verse (e.g. `אב״ג ית״ץ` for verse 1). Together the 49\n * entries (7 verses × 7 entries) align with the 49 days of the Omer, connecting\n * each day to one of the lower seven Sefirot within a Sefirah.\n * @returns a Hebrew word or verse-abbreviation string from Ana BeKoach\n * @example\n * const ev = new OmerEvent(new HDate(16, 'Nisan', 5785), 1);\n * ev.getAnaBekoachWord(); // 'אָנָּא' (day 1, first word of verse 1)\n * @example\n * const ev = new OmerEvent(new HDate(22, 'Nisan', 5785), 7);\n * ev.getAnaBekoachWord(); // 'אב״ג ית״ץ' (day 7, acrostic abbreviation for verse 1)\n * @example\n * const ev = new OmerEvent(new HDate(3, 'Sivan', 5785), 49);\n * ev.getAnaBekoachWord(); // 'שק״ו צי״ת' (day 49, acrostic abbreviation for verse 7)\n */\n getAnaBekoachWord(): string {\n return anaBekoach[this.omer - 1].normalize();\n }\n}\n"],"names":[],"mappings":";;;;;;AAWA,MAAM,OAAO,GAAG;AACd,IAAA,EAAE,EAAE;AACF,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,OAAO,EAAE,SAAS;AAClB,QAAA,KAAK,EAAE;YACL,EAAE;YACF,gBAAgB;YAChB,OAAO;YACP,QAAQ;YACR,UAAU;YACV,UAAU;YACV,YAAY;YACZ,SAAS;AACV,SAAA;AACD,QAAA,QAAQ,EAAE,IAAI;AACf,KAAA;AACD,IAAA,EAAE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;;;;;;AAkBG;IACH,iBAAiB,GAAA;QACf,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE;IAC9C;AACD;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.5.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.5.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import './locale.js';
3
3
  import { Locale } from '@hebcal/hdate';
4
4
 
@@ -1,6 +1,17 @@
1
1
  import { ParshaEvent } from './ParshaEvent';
2
2
  /**
3
- * Calculates weekly Torah Reading on Saturdays for entire year
3
+ * Calculates the weekly Torah Reading (Parashat HaShavua) on Saturdays for
4
+ * an entire Hebrew year.
5
+ *
6
+ * Saturdays on which a Yom Tov reading displaces the regular parsha
7
+ * (e.g. Shabbat Chol ha-Moed Pesach/Sukkot, Yom Kippur on Shabbat) are
8
+ * skipped — for those use {@link getHolidaysOnDate} or
9
+ * {@link Sedra.lookup}.
10
+ * @example
11
+ * import {parshaYear} from '@hebcal/core';
12
+ * const events = parshaYear(5784, false);
13
+ * events[0].render('en'); // 'Parashat Vayeilech'
14
+ * events[0].getDate().toString(); // '4 Tishrei 5784'
4
15
  * @param year Hebrew year
5
16
  * @param il Israel (false for Diaspora)
6
17
  * @returns an array of `ParshaEvent` occurring on Saturdays that contain a regular
@@ -1,10 +1,21 @@
1
- /*! @hebcal/core v6.5.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.5.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { HDate, months } from '@hebcal/hdate';
3
3
  import { ParshaEvent } from './ParshaEvent.js';
4
4
  import { getSedra } from './sedra.js';
5
5
 
6
6
  /**
7
- * Calculates weekly Torah Reading on Saturdays for entire year
7
+ * Calculates the weekly Torah Reading (Parashat HaShavua) on Saturdays for
8
+ * an entire Hebrew year.
9
+ *
10
+ * Saturdays on which a Yom Tov reading displaces the regular parsha
11
+ * (e.g. Shabbat Chol ha-Moed Pesach/Sukkot, Yom Kippur on Shabbat) are
12
+ * skipped — for those use {@link getHolidaysOnDate} or
13
+ * {@link Sedra.lookup}.
14
+ * @example
15
+ * import {parshaYear} from '@hebcal/core';
16
+ * const events = parshaYear(5784, false);
17
+ * events[0].render('en'); // 'Parashat Vayeilech'
18
+ * events[0].getDate().toString(); // '4 Tishrei 5784'
8
19
  * @param year Hebrew year
9
20
  * @param il Israel (false for Diaspora)
10
21
  * @returns an array of `ParshaEvent` occurring on Saturdays that contain a regular
@@ -1 +1 @@
1
- {"version":3,"file":"parshaYear.js","sources":["../../../src/parshaYear.ts"],"sourcesContent":["import {HDate, months} from '@hebcal/hdate';\nimport {ParshaEvent} from './ParshaEvent';\nimport {getSedra} from './sedra';\n\n/**\n * Calculates weekly Torah Reading on Saturdays for entire year\n * @param year Hebrew year\n * @param il Israel (false for Diaspora)\n * @returns an array of `ParshaEvent` occurring on Saturdays that contain a regular\n * (non-holiday) Parashat HaShavua\n */\nexport function parshaYear(year: number, il: boolean): ParshaEvent[] {\n const sedra = getSedra(year, il);\n const startAbs = sedra.getFirstSaturday();\n const endAbs = HDate.hebrew2abs(year, months.ELUL, 29);\n const events: ParshaEvent[] = [];\n for (let absDt = startAbs; absDt <= endAbs; absDt += 7) {\n const parsha = sedra.lookup(absDt);\n if (!parsha.chag) {\n const ev = new ParshaEvent(parsha);\n events.push(ev);\n }\n }\n return events;\n}\n"],"names":[],"mappings":";;;;;AAIA;;;;;;AAMG;AACG,SAAU,UAAU,CAAC,IAAY,EAAE,EAAW,EAAA;IAClD,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;AAChC,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,gBAAgB,EAAE;AACzC,IAAA,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;IACtD,MAAM,MAAM,GAAkB,EAAE;AAChC,IAAA,KAAK,IAAI,KAAK,GAAG,QAAQ,EAAE,KAAK,IAAI,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE;QACtD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;AAClC,QAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;AAChB,YAAA,MAAM,EAAE,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC;AAClC,YAAA,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACjB;IACF;AACA,IAAA,OAAO,MAAM;AACf;;;;"}
1
+ {"version":3,"file":"parshaYear.js","sources":["../../../src/parshaYear.ts"],"sourcesContent":["import {HDate, months} from '@hebcal/hdate';\nimport {ParshaEvent} from './ParshaEvent';\nimport {getSedra} from './sedra';\n\n/**\n * Calculates the weekly Torah Reading (Parashat HaShavua) on Saturdays for\n * an entire Hebrew year.\n *\n * Saturdays on which a Yom Tov reading displaces the regular parsha\n * (e.g. Shabbat Chol ha-Moed Pesach/Sukkot, Yom Kippur on Shabbat) are\n * skipped — for those use {@link getHolidaysOnDate} or\n * {@link Sedra.lookup}.\n * @example\n * import {parshaYear} from '@hebcal/core';\n * const events = parshaYear(5784, false);\n * events[0].render('en'); // 'Parashat Vayeilech'\n * events[0].getDate().toString(); // '4 Tishrei 5784'\n * @param year Hebrew year\n * @param il Israel (false for Diaspora)\n * @returns an array of `ParshaEvent` occurring on Saturdays that contain a regular\n * (non-holiday) Parashat HaShavua\n */\nexport function parshaYear(year: number, il: boolean): ParshaEvent[] {\n const sedra = getSedra(year, il);\n const startAbs = sedra.getFirstSaturday();\n const endAbs = HDate.hebrew2abs(year, months.ELUL, 29);\n const events: ParshaEvent[] = [];\n for (let absDt = startAbs; absDt <= endAbs; absDt += 7) {\n const parsha = sedra.lookup(absDt);\n if (!parsha.chag) {\n const ev = new ParshaEvent(parsha);\n events.push(ev);\n }\n }\n return events;\n}\n"],"names":[],"mappings":";;;;;AAIA;;;;;;;;;;;;;;;;;AAiBG;AACG,SAAU,UAAU,CAAC,IAAY,EAAE,EAAW,EAAA;IAClD,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;AAChC,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,gBAAgB,EAAE;AACzC,IAAA,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;IACtD,MAAM,MAAM,GAAkB,EAAE;AAChC,IAAA,KAAK,IAAI,KAAK,GAAG,QAAQ,EAAE,KAAK,IAAI,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE;QACtD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;AAClC,QAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;AAChB,YAAA,MAAM,EAAE,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC;AAClC,YAAA,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACjB;IACF;AACA,IAAA,OAAO,MAAM;AACf;;;;"}
@@ -1,2 +1,2 @@
1
1
  /** DO NOT EDIT THIS AUTO-GENERATED FILE! */
2
- export declare const version = "6.5.1";
2
+ export declare const version = "6.5.2";
@@ -1,6 +1,6 @@
1
- /*! @hebcal/core v6.5.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.5.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  /** DO NOT EDIT THIS AUTO-GENERATED FILE! */
3
- const version = '6.5.1';
3
+ const version = '6.5.2';
4
4
 
5
5
  export { version };
6
6
  //# sourceMappingURL=pkgVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pkgVersion.js","sources":["../../../src/pkgVersion.ts"],"sourcesContent":["/** DO NOT EDIT THIS AUTO-GENERATED FILE! */\nexport const version = '6.5.1';\n"],"names":[],"mappings":";AAAA;AACO,MAAM,OAAO,GAAG;;;;"}
1
+ {"version":3,"file":"pkgVersion.js","sources":["../../../src/pkgVersion.ts"],"sourcesContent":["/** DO NOT EDIT THIS AUTO-GENERATED FILE! */\nexport const version = '6.5.2';\n"],"names":[],"mappings":";AAAA;AACO,MAAM,OAAO,GAAG;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.5.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.5.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  const hour12cc = {
3
3
  US: 1,
4
4
  CA: 1,
@@ -27,7 +27,23 @@ export type SedraResult = {
27
27
  il: boolean;
28
28
  };
29
29
  /**
30
- * Represents Parashah HaShavua for an entire Hebrew year
30
+ * Represents the weekly Torah-reading (Parashat HaShavua) schedule for an
31
+ * entire Hebrew year.
32
+ *
33
+ * The schedule depends on the year's *keviyah* — the day of week of Rosh
34
+ * Hashana, whether the year is leap, whether Cheshvan/Kislev are long or
35
+ * short, and whether the schedule is for Israel or the Diaspora (since
36
+ * Israel and the Diaspora diverge in some years when the 8th day of Pesach
37
+ * or the 2nd day of Shavuot fall on Shabbat).
38
+ *
39
+ * Prefer {@link getSedra} (or {@link HebrewCalendar.getSedra}) over
40
+ * calling this constructor directly, since both cache their results.
41
+ *
42
+ * @example
43
+ * import {Sedra, HDate, months} from '@hebcal/core';
44
+ * const sedra = new Sedra(5784, false);
45
+ * const result = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));
46
+ * console.log(result.parsha); // ['Lech-Lecha']
31
47
  */
32
48
  export declare class Sedra {
33
49
  private readonly year;
@@ -37,14 +53,29 @@ export declare class Sedra {
37
53
  private readonly theSedraArray;
38
54
  private readonly yearKey;
39
55
  /**
40
- * Caculates the Parashah HaShavua for an entire Hebrew year
56
+ * Calculates the Parashat HaShavua schedule for an entire Hebrew year.
41
57
  * @param hyear - Hebrew year (e.g. 5749)
42
58
  * @param il - Use Israel sedra schedule (false for Diaspora)
43
59
  */
44
60
  constructor(hyear: number, il: boolean);
45
61
  /**
46
- * Returns the date that a parsha occurs
47
- * or `null` if the parsha doesn't occur this year
62
+ * Returns the date a parsha is read this year, or `null` if it does not
63
+ * occur in this year's schedule.
64
+ *
65
+ * A doubled parsha (e.g. `'Matot-Masei'`) will only return a date in years
66
+ * where that pair is actually read together; in years where they are read
67
+ * separately, this returns `null`. Use {@link findContaining} to find the
68
+ * date a parsha is read regardless of whether it is doubled.
69
+ *
70
+ * Throws `RangeError` for an out-of-range numeric input or an invalid
71
+ * doubled-parsha pair, and `TypeError` for a malformed array argument.
72
+ * @example
73
+ * import {Sedra} from '@hebcal/core';
74
+ * const sedra = new Sedra(5784, false);
75
+ * sedra.find('Noach')?.toString(); // '15 Cheshvan 5784'
76
+ * sedra.find(1)?.toString(); // same, by 0-based index
77
+ * sedra.find('Matot-Masei')?.toString(); // null in 5784 — read separately
78
+ * sedra.find(['Matot', 'Masei']); // also null in 5784
48
79
  * @param parsha if a `string`, specified with Sephardic transliterations
49
80
  * like `'Noach'` or `'Matot-Masei'`. If an array, must be a 1- or 2-element
50
81
  * array such as `['Noach']` or `['Matot', 'Masei']`. If a `number`, should
@@ -54,22 +85,63 @@ export declare class Sedra {
54
85
  find(parsha: number | string | string[]): HDate | null;
55
86
  private findInternal;
56
87
  /**
57
- * Returns the date that a parsha (or its doubled or undoubled counterpart)
58
- * occurs, or `null` if the parsha doesn't occur this year
88
+ * Returns the date a parsha is read this year, looking through both
89
+ * single and doubled forms.
90
+ *
91
+ * For example, if `'Matot'` is read individually this year, this returns
92
+ * its date; if it is read as part of `'Matot-Masei'` this year, this
93
+ * returns the date of `'Matot-Masei'` (and similarly for `'Masei'`).
94
+ * Conversely, asking for `'Matot-Masei'` in a year where they are split
95
+ * will return the date of `'Matot'` alone.
96
+ * @example
97
+ * import {Sedra} from '@hebcal/core';
98
+ * const sedra = new Sedra(5784, false);
99
+ * // Matot-Masei is split in 5784; both individual halves resolve:
100
+ * sedra.findContaining('Matot')?.toString(); // '22 Tamuz 5784'
101
+ * sedra.findContaining('Masei')?.toString(); // '29 Tamuz 5784'
102
+ * // Asking for the doubled name returns the date of the first half:
103
+ * sedra.findContaining('Matot-Masei')?.toString(); // '22 Tamuz 5784'
59
104
  */
60
105
  findContaining(parsha: number | string): HDate | null;
61
106
  /**
62
- * Returns the underlying annual sedra schedule.
63
- * Used by `@hebcal/triennial`
107
+ * Returns the underlying annual reading schedule as an array, where each
108
+ * entry corresponds to one Saturday (starting from the first Shabbat on
109
+ * or after Rosh Hashana). Entries are either:
110
+ * - a non-negative `number`: a 0-based parsha index (e.g. `0` for
111
+ * *Bereshit*)
112
+ * - a negative `number`: the negated first index of a doubled parsha
113
+ * (e.g. `-21` for *Vayakhel-Pekudei*)
114
+ * - a `string`: a holiday name when a Yom Tov displaces the weekly reading
115
+ * (e.g. `'Pesach Shabbat Chol ha-Moed'`, `'Yom Kippur'`)
116
+ *
117
+ * Used by `@hebcal/triennial`.
64
118
  */
65
119
  getSedraArray(): readonly NumberOrString[];
66
120
  /**
67
- * R.D. date of the first Saturday on or after Rosh Hashana
121
+ * Returns the R.D. (Rata Die / Fixed Date) absolute day number of the
122
+ * first Saturday on or after Rosh Hashana of this year. This is the
123
+ * anchor point for {@link getSedraArray} — index `0` of that array
124
+ * corresponds to this date.
68
125
  */
69
126
  getFirstSaturday(): number;
127
+ /** Returns the Hebrew year this `Sedra` instance covers. */
70
128
  getYear(): number;
71
129
  /**
72
- * Returns an object describing the parsha on the first Saturday on or after `hd`
130
+ * Returns details about the parsha read on the first Saturday on or after
131
+ * `hd`. If `hd` is itself a Saturday, the reading for that date is
132
+ * returned; otherwise the reading for the upcoming Saturday is returned.
133
+ *
134
+ * If the given date falls in the final days of the Hebrew year (after
135
+ * the last reading of this year's schedule), this method transparently
136
+ * delegates to the next year's `Sedra`.
137
+ * @example
138
+ * import {Sedra, HDate, months} from '@hebcal/core';
139
+ * const sedra = new Sedra(5784, false);
140
+ * // A weekday — returns the upcoming Shabbat's reading
141
+ * const result = sedra.lookup(new HDate(13, months.CHESHVAN, 5784));
142
+ * console.log(result.parsha); // ['Lech-Lecha']
143
+ * console.log(result.chag); // false
144
+ * console.log(result.hdate.toString()); // '15 Cheshvan 5784' (Saturday)
73
145
  * @param hd Hebrew date or R.D. days
74
146
  */
75
147
  lookup(hd: HDate | number): SedraResult;
@@ -86,10 +158,18 @@ export declare class Sedra {
86
158
  export declare const parshiot: readonly string[];
87
159
  type NumberOrString = number | string;
88
160
  /**
89
- * Convenience function to create an instance of `Sedra` or reuse a previously
90
- * created and cached instance.
91
- * @param hyear
92
- * @param il
161
+ * Convenience function to create an instance of {@link Sedra} or reuse a
162
+ * previously created and cached instance for the same year and schedule.
163
+ *
164
+ * Prefer this over `new Sedra(...)` when calling repeatedly — an internal
165
+ * LRU cache (~120 entries) avoids recomputing the keviyah-specific schedule.
166
+ * @example
167
+ * import {getSedra, HDate, months} from '@hebcal/core';
168
+ * const sedra = getSedra(5784, false);
169
+ * const {parsha} = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));
170
+ * console.log(parsha); // ['Lech-Lecha']
171
+ * @param hyear Hebrew year
172
+ * @param il Use Israel sedra schedule (`false` for Diaspora)
93
173
  */
94
174
  export declare function getSedra(hyear: number, il: boolean): Sedra;
95
175
  export {};
package/dist/esm/sedra.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/core v6.5.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1
+ /*! @hebcal/core v6.5.2, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
2
2
  import { HDate, months } from '@hebcal/hdate';
3
3
  import QuickLRU from 'quick-lru';
4
4
  import './locale.js';
@@ -51,7 +51,23 @@ function yearType(hyear) {
51
51
  }
52
52
  }
53
53
  /**
54
- * Represents Parashah HaShavua for an entire Hebrew year
54
+ * Represents the weekly Torah-reading (Parashat HaShavua) schedule for an
55
+ * entire Hebrew year.
56
+ *
57
+ * The schedule depends on the year's *keviyah* — the day of week of Rosh
58
+ * Hashana, whether the year is leap, whether Cheshvan/Kislev are long or
59
+ * short, and whether the schedule is for Israel or the Diaspora (since
60
+ * Israel and the Diaspora diverge in some years when the 8th day of Pesach
61
+ * or the 2nd day of Shavuot fall on Shabbat).
62
+ *
63
+ * Prefer {@link getSedra} (or {@link HebrewCalendar.getSedra}) over
64
+ * calling this constructor directly, since both cache their results.
65
+ *
66
+ * @example
67
+ * import {Sedra, HDate, months} from '@hebcal/core';
68
+ * const sedra = new Sedra(5784, false);
69
+ * const result = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));
70
+ * console.log(result.parsha); // ['Lech-Lecha']
55
71
  */
56
72
  class Sedra {
57
73
  year;
@@ -61,7 +77,7 @@ class Sedra {
61
77
  theSedraArray;
62
78
  yearKey;
63
79
  /**
64
- * Caculates the Parashah HaShavua for an entire Hebrew year
80
+ * Calculates the Parashat HaShavua schedule for an entire Hebrew year.
65
81
  * @param hyear - Hebrew year (e.g. 5749)
66
82
  * @param il - Use Israel sedra schedule (false for Diaspora)
67
83
  */
@@ -91,8 +107,23 @@ class Sedra {
91
107
  }
92
108
  }
93
109
  /**
94
- * Returns the date that a parsha occurs
95
- * or `null` if the parsha doesn't occur this year
110
+ * Returns the date a parsha is read this year, or `null` if it does not
111
+ * occur in this year's schedule.
112
+ *
113
+ * A doubled parsha (e.g. `'Matot-Masei'`) will only return a date in years
114
+ * where that pair is actually read together; in years where they are read
115
+ * separately, this returns `null`. Use {@link findContaining} to find the
116
+ * date a parsha is read regardless of whether it is doubled.
117
+ *
118
+ * Throws `RangeError` for an out-of-range numeric input or an invalid
119
+ * doubled-parsha pair, and `TypeError` for a malformed array argument.
120
+ * @example
121
+ * import {Sedra} from '@hebcal/core';
122
+ * const sedra = new Sedra(5784, false);
123
+ * sedra.find('Noach')?.toString(); // '15 Cheshvan 5784'
124
+ * sedra.find(1)?.toString(); // same, by 0-based index
125
+ * sedra.find('Matot-Masei')?.toString(); // null in 5784 — read separately
126
+ * sedra.find(['Matot', 'Masei']); // also null in 5784
96
127
  * @param parsha if a `string`, specified with Sephardic transliterations
97
128
  * like `'Noach'` or `'Matot-Masei'`. If an array, must be a 1- or 2-element
98
129
  * array such as `['Noach']` or `['Matot', 'Masei']`. If a `number`, should
@@ -152,8 +183,22 @@ class Sedra {
152
183
  return new HDate(this.firstSaturday + idx * 7);
153
184
  }
154
185
  /**
155
- * Returns the date that a parsha (or its doubled or undoubled counterpart)
156
- * occurs, or `null` if the parsha doesn't occur this year
186
+ * Returns the date a parsha is read this year, looking through both
187
+ * single and doubled forms.
188
+ *
189
+ * For example, if `'Matot'` is read individually this year, this returns
190
+ * its date; if it is read as part of `'Matot-Masei'` this year, this
191
+ * returns the date of `'Matot-Masei'` (and similarly for `'Masei'`).
192
+ * Conversely, asking for `'Matot-Masei'` in a year where they are split
193
+ * will return the date of `'Matot'` alone.
194
+ * @example
195
+ * import {Sedra} from '@hebcal/core';
196
+ * const sedra = new Sedra(5784, false);
197
+ * // Matot-Masei is split in 5784; both individual halves resolve:
198
+ * sedra.findContaining('Matot')?.toString(); // '22 Tamuz 5784'
199
+ * sedra.findContaining('Masei')?.toString(); // '29 Tamuz 5784'
200
+ * // Asking for the doubled name returns the date of the first half:
201
+ * sedra.findContaining('Matot-Masei')?.toString(); // '22 Tamuz 5784'
157
202
  */
158
203
  findContaining(parsha) {
159
204
  const hdate = this.find(parsha);
@@ -196,23 +241,50 @@ class Sedra {
196
241
  }
197
242
  }
198
243
  /**
199
- * Returns the underlying annual sedra schedule.
200
- * Used by `@hebcal/triennial`
244
+ * Returns the underlying annual reading schedule as an array, where each
245
+ * entry corresponds to one Saturday (starting from the first Shabbat on
246
+ * or after Rosh Hashana). Entries are either:
247
+ * - a non-negative `number`: a 0-based parsha index (e.g. `0` for
248
+ * *Bereshit*)
249
+ * - a negative `number`: the negated first index of a doubled parsha
250
+ * (e.g. `-21` for *Vayakhel-Pekudei*)
251
+ * - a `string`: a holiday name when a Yom Tov displaces the weekly reading
252
+ * (e.g. `'Pesach Shabbat Chol ha-Moed'`, `'Yom Kippur'`)
253
+ *
254
+ * Used by `@hebcal/triennial`.
201
255
  */
202
256
  getSedraArray() {
203
257
  return this.theSedraArray;
204
258
  }
205
259
  /**
206
- * R.D. date of the first Saturday on or after Rosh Hashana
260
+ * Returns the R.D. (Rata Die / Fixed Date) absolute day number of the
261
+ * first Saturday on or after Rosh Hashana of this year. This is the
262
+ * anchor point for {@link getSedraArray} — index `0` of that array
263
+ * corresponds to this date.
207
264
  */
208
265
  getFirstSaturday() {
209
266
  return this.firstSaturday;
210
267
  }
268
+ /** Returns the Hebrew year this `Sedra` instance covers. */
211
269
  getYear() {
212
270
  return this.year;
213
271
  }
214
272
  /**
215
- * Returns an object describing the parsha on the first Saturday on or after `hd`
273
+ * Returns details about the parsha read on the first Saturday on or after
274
+ * `hd`. If `hd` is itself a Saturday, the reading for that date is
275
+ * returned; otherwise the reading for the upcoming Saturday is returned.
276
+ *
277
+ * If the given date falls in the final days of the Hebrew year (after
278
+ * the last reading of this year's schedule), this method transparently
279
+ * delegates to the next year's `Sedra`.
280
+ * @example
281
+ * import {Sedra, HDate, months} from '@hebcal/core';
282
+ * const sedra = new Sedra(5784, false);
283
+ * // A weekday — returns the upcoming Shabbat's reading
284
+ * const result = sedra.lookup(new HDate(13, months.CHESHVAN, 5784));
285
+ * console.log(result.parsha); // ['Lech-Lecha']
286
+ * console.log(result.chag); // false
287
+ * console.log(result.hdate.toString()); // '15 Cheshvan 5784' (Saturday)
216
288
  * @param hd Hebrew date or R.D. days
217
289
  */
218
290
  lookup(hd) {
@@ -469,10 +541,18 @@ types['1311'] = types['1221'];
469
541
  types['1721'] = types['170'];
470
542
  const sedraCache = new QuickLRU({ maxSize: 120 });
471
543
  /**
472
- * Convenience function to create an instance of `Sedra` or reuse a previously
473
- * created and cached instance.
474
- * @param hyear
475
- * @param il
544
+ * Convenience function to create an instance of {@link Sedra} or reuse a
545
+ * previously created and cached instance for the same year and schedule.
546
+ *
547
+ * Prefer this over `new Sedra(...)` when calling repeatedly — an internal
548
+ * LRU cache (~120 entries) avoids recomputing the keviyah-specific schedule.
549
+ * @example
550
+ * import {getSedra, HDate, months} from '@hebcal/core';
551
+ * const sedra = getSedra(5784, false);
552
+ * const {parsha} = sedra.lookup(new HDate(15, months.CHESHVAN, 5784));
553
+ * console.log(parsha); // ['Lech-Lecha']
554
+ * @param hyear Hebrew year
555
+ * @param il Use Israel sedra schedule (`false` for Diaspora)
476
556
  */
477
557
  function getSedra(hyear, il) {
478
558
  const cacheKey = `${hyear}-${il ? 1 : 0}`;