Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@hebcal/leyning
Advanced tools
Javascript Torah Reading API for Parashat HaShavua and holidays
This package includes both traditional (full kriyah), triennial and weekday Torah readings.
“Many congregations pattern their weekly Torah reading cycle after a system similar to the one used in ancient Israel during the rabbinic period. In this system, the traditional parashiot are each divided into three shorter segments, and the whole Torah is completed once every three years. The system has both advantages and disadvantages, but its ability to shorten the length of Torah reading without sacrificing the complete reading of the Torah on a regular basis has made it the choice of some synagogues in the Conservative Movement.”
Update December 2021: In November 2020, the CJLS modified the triennial cycle for some combined parshiyot to change the reading for year 3 to be the third section of the parashah.
Modification of the Triennial Cycle Readings for Combined Parashot in Certain Years, Rabbi Miles B. Cohen
Update August 2022: Incorporated An Emendation to Richard Eisenberg’s Complete Triennial System for Reading Torah, to Address a Rare Situation, Rabbi Joshua Heller, 2012
$ npm install @hebcal/leyning
import {HebrewCalendar, HDate, Event} from '@hebcal/core';
import {getLeyningForParshaHaShavua, getTriennialForParshaHaShavua,
formatAliyahWithBook} from '@hebcal/leyning';
const events = HebrewCalendar.calendar({sedrot: true, noHolidays: true});
const ev = events.find((ev) => ev.getDesc() == 'Parashat Pinchas');
const reading = getLeyningForParshaHaShavua(ev);
console.log(`${ev.getDesc()}: ${reading.summary}`);
console.log(`Haftara: ${reading.haftara}`);
for (const [num, aliyah] of Object.entries(reading.fullkriyah)) {
const number = num == 'M' ? 'maftir' : `aliyah ${num}`;
let str = formatAliyahWithBook(aliyah);
if (reading.reason[num]) {
str += ' | ' + reading.reason[num];
}
str += ` (${aliyah.v} verses)`;
console.log(`${number}: ${str}`);
}
const triReading = getTriennialForParshaHaShavua(ev);
for (const [num, aliyah] of Object.entries(triReading)) {
const number = num == 'M' ? 'maftir' : `aliyah ${num}`;
const str = formatAliyahWithBook(aliyah);
console.log(`Triennial ${number}: ${str}`);
}
Triennial Torah readings
Names of the books of the Torah. BOOK[1] === 'Genesis'
Makes Sefaria links by adding href
, verses
and num
attributes to each aliyah.
CAUTION: Modifies the aliyot
parameter instead of making a copy.
string
Formats an aliyah object like "Numbers 28:9-28:15"
string
Formats an aliyah object like "Numbers 28:9-15"
string
Based on the event date, type and title, finds the relevant leyning key
Leyning
Looks up leyning for a given holiday. Returns some of full kriyah aliyot, special Maftir, special Haftarah
string
Makes a summary of the leyning, like "Genesis 6:9-11:32"
Leyning
Looks up leyning for a given holiday key. Key should be an (untranslated) string used in holiday-readings.json. Returns some of full kriyah aliyot, special Maftir, special Haftarah
Leyning
Looks up regular leyning for a weekly parsha with no special readings
Leyning
Looks up leyning for a regular Shabbat parsha, including any special maftir or Haftara.
Leyning
Looks up leyning for a regular Shabbat, Monday/Thursday weekday or holiday.
If hdate
coincides with a holiday that has Torah reading, returns the
reading for that day (see getLeyningForHoliday)
Otherwise, if hdate
is a Saturday, returns getLeyningForParshaHaShavua
Otherwise, if hdate
is a Monday or Thursday, returns Leyning for the
Parashat haShavua, containing only the weekday
aliyot (no fullkriyah
).
Otherwise, returns undefined
.
Triennial
Calculates the 3-year readings for a given year
TriennialAliyot
| Object.<string, Aliyah>
Looks up the triennial leyning for this Parashat HaShavua
Object
Looks up the alternative triennial Haftara for a holiday
Object
Represents an aliyah
Object
Name of the parsha hashavua or holiday
Object
Leyning for a parsha hashavua or holiday
Object
Represents triennial aliyot for a given date
Triennial Torah readings
Kind: global class
Object.<string, Aliyah>
number
string
number
number
Builds a Triennial object
Param | Type | Description |
---|---|---|
[hebrewYear] | number | Hebrew Year (default current year) |
Object.<string, Aliyah>
Kind: instance method of Triennial
Returns: Object.<string, Aliyah>
- a map of aliyot 1-7 plus "M"
Param | Type | Description |
---|---|---|
parsha | string | parsha name ("Bereshit" or "Achrei Mot-Kedoshim") |
yearNum | number | 0 through 2 for which year of Triennial cycle |
number
Kind: instance method of Triennial
string
Kind: instance method of Triennial
number
Returns triennial year 1, 2 or 3 based on this Hebrew year
Kind: static method of Triennial
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
number
Returns Hebrew year that this 3-year triennial cycle began
Kind: static method of Triennial
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
Names of the books of the Torah. BOOK[1] === 'Genesis'
Deprecated
Makes Sefaria links by adding href
, verses
and num
attributes to each aliyah.
CAUTION: Modifies the aliyot
parameter instead of making a copy.
Kind: global function
Param | Type | Description |
---|---|---|
aliyot | Object.<string, Aliyah> | aliyah map to decorate |
showBook | boolean | display the book name in the verses field (e.g. for special Maftir) |
string
Formats an aliyah object like "Numbers 28:9-28:15"
Kind: global function
Param | Type | Description |
---|---|---|
a | Aliyah | aliyah |
string
Formats an aliyah object like "Numbers 28:9-15"
Kind: global function
Param | Type |
---|---|
aliyah | Aliyah |
showBook | boolean |
string
Based on the event date, type and title, finds the relevant leyning key
Kind: global function
Returns: string
- key to look up in holiday-reading.json
Param | Type | Default | Description |
---|---|---|---|
e | Event | event | |
[il] | boolean | false | true if Israel holiday scheme |
Leyning
Looks up leyning for a given holiday. Returns some of full kriyah aliyot, special Maftir, special Haftarah
Kind: global function
Returns: Leyning
- map of aliyot
Param | Type | Default | Description |
---|---|---|---|
e | Event | the Hebcal event associated with this leyning | |
[il] | boolean | false | true if Israel holiday scheme |
string
Makes a summary of the leyning, like "Genesis 6:9-11:32"
Kind: global function
Param | Type |
---|---|
aliyot | Object.<string, Aliyah> |
Leyning
Looks up leyning for a given holiday key. Key should be an (untranslated) string used in holiday-readings.json. Returns some of full kriyah aliyot, special Maftir, special Haftarah
Kind: global function
Returns: Leyning
- map of aliyot
Param | Type | Description |
---|---|---|
key | string | name from holiday-readings.json to find |
[cholHaMoedDay] | number |
Leyning
Looks up regular leyning for a weekly parsha with no special readings
Kind: global function
Returns: Leyning
- map of aliyot
Param | Type | Description |
---|---|---|
parsha | string | Array.<string> | untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei'] |
Leyning
Kind: inner constant of getLeyningForParsha
Leyning
Looks up leyning for a regular Shabbat parsha, including any special maftir or Haftara.
Kind: global function
Returns: Leyning
- map of aliyot
Param | Type | Default | Description |
---|---|---|---|
ev | Event | the Hebcal event associated with this leyning | |
[il] | boolean | false | in Israel |
Leyning
Looks up leyning for a regular Shabbat, Monday/Thursday weekday or holiday.
If hdate
coincides with a holiday that has Torah reading, returns the
reading for that day (see getLeyningForHoliday)
Otherwise, if hdate
is a Saturday, returns getLeyningForParshaHaShavua
Otherwise, if hdate
is a Monday or Thursday, returns Leyning for the
Parashat haShavua, containing only the weekday
aliyot (no fullkriyah
).
Otherwise, returns undefined
.
Kind: global function
Returns: Leyning
- map of aliyot
Param | Type | Description |
---|---|---|
hdate | HDate | Hebrew Date |
il | boolean | in Israel |
Triennial
Calculates the 3-year readings for a given year
Kind: global function
Param | Type | Description |
---|---|---|
year | number | Hebrew year |
TriennialAliyot
| Object.<string, Aliyah>
Looks up the triennial leyning for this Parashat HaShavua
Kind: global function
Returns: TriennialAliyot
| Object.<string, Aliyah>
- a map of aliyot 1-7 plus "M"
Param | Type | Default | Description |
---|---|---|---|
ev | Event | ||
[context] | boolean | false | returns a reading wrapper object which includes date , yearNum and aliyot |
Object
Looks up the alternative triennial Haftara for a holiday
Kind: global function
Param | Type |
---|---|
key | string |
yearNum | number |
Object
Represents an aliyah
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
k | string | Book (e.g. "Numbers") |
b | string | beginning verse (e.g. "28:9") |
e | string | ending verse (e.g. "28:15") |
[v] | number | number of verses |
[p] | number | parsha number (1=Bereshit, 54=Vezot HaBracha) |
Object
Name of the parsha hashavua or holiday
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
en | string | English |
he | string | Hebrew (with nikud) |
Object
Leyning for a parsha hashavua or holiday
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
name | LeyningNames | |
[parsha] | Array.<string> | An array of either 1 (regular) or 2 (doubled parsha). undefined for holiday readings |
[parshaNum] | num | 1 for Bereshit, 2 for Noach, etc. undefined for holiday readings |
summary | string | Such as Genesis 1:1 - 6:8 |
haft | Aliyah | Array.<Aliyah> | Haftarah object(s) |
haftara | string | Haftarah, such as Isaiah 42:5 – 43:11 |
[haftaraNumV] | number | Number of verses in the Haftarah |
[seph] | Aliyah | Array.<Aliyah> | Haftarah object(s) for Sephardim |
[sephardic] | string | Haftarah for Sephardim, such as Isaiah 42:5 - 42:21 |
[sephardicNumV] | number | Number of verses in the Haftarah for Sephardim |
fullkriyah | Object.<string, Aliyah> | Map of aliyot 1 through 7 plus M for maftir |
[weekday] | Object.<string, Aliyah> | Optional map of weekday Torah Readings aliyot 1 through 3 for Monday and Thursday |
[reason] | Object.<string, string> | Explanations for special readings, keyed by aliyah number, M for maftir or haftara for Haftarah |
Object
Represents triennial aliyot for a given date
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
aliyot | Object.<string, Aliyah> | a map of aliyot 1-7 plus "M" |
yearNum | number | year number, 0-2 |
date | Date | Shabbat date for when this parsha is read in this 3-year cycle |
[readSeparately] | boolean | true if a double parsha is read separately in year yearNum |
[date1] | Date | Shabbat date of the first part of a read-separately aliyah pair |
[date2] | Date | Shabbat date of the second part of a read-separately aliyah pair |
FAQs
Torah Reading API for Parashat HaShavua and holidays
We found that @hebcal/leyning demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.