8.1.9 • Published 2 days ago

@hebcal/leyning v8.1.9

Weekly downloads
28
License
BSD-2-Clause
Repository
github
Last release
2 days ago

@hebcal/leyning

Javascript Torah Reading API for Parashat HaShavua and holidays

Build Status

This package includes both traditional (full kriyah) and weekday Torah readings.

Triennial Torah Readings have moved to @hebcal/triennial

Installation

$ npm install @hebcal/leyning

Synopsis

import {HebrewCalendar, HDate, Event} from '@hebcal/core';
import {getLeyningForParshaHaShavua, 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, false);
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}`);
}

Constants

Functions

Typedefs

BOOK : Array.<string>

Names of the books of the Torah. BOOK1 === 'Genesis'

Kind: global constant
Read only: true

parshaToString(parsha) ⇒ string

Formats parsha as a string

Kind: global function

ParamTypeDescription
parshastring | Array.<string>untranslated name like 'Pinchas' or 'Pinchas' or 'Matot','Masei'

clone(src) ⇒ any

Makes a deep copy of the src object using JSON stringify and parse

Kind: global function

ParamType
srcany

calculateNumVerses(aliyah) ⇒ number

Calculates the number of verses in an aliyah or haftara based on the b (begin verse), e (end verse) and k (book). Modifies aliyah by setting the v field.

Kind: global function

ParamType
aliyahAliyah

formatAliyahWithBook(a) ⇒ string

Formats an aliyah object like "Numbers 28:9-28:15"

Kind: global function

ParamTypeDescription
aAliyahaliyah

formatAliyahShort(aliyah, showBook) ⇒ string

Formats an aliyah object like "Numbers 28:9-15"

Kind: global function

ParamType
aliyahAliyah
showBookboolean

sumVerses(aliyot) ⇒ number

Returns the total number of verses in an array of Aliyah (or haftarah) objects

Kind: global function

ParamType
aliyotAliyah | Array.<Aliyah>

makeLeyningParts(aliyot) ⇒ Array.<Aliyah>

Summarizes an AliyotMap by collapsing all adjacent aliyot. Finds any non-overlapping parts (e.g. special 7th aliyah or maftir)

Kind: global function

ParamType
aliyotObject.<string, Aliyah>

makeSummaryFromParts(parts) ⇒ string

Returns a string representation of the leyning parts. Separate verse ranges read from the same book are separated by commas, e.g. Isaiah 6:1-7:6, 9:5-6. Verse ranges from different books are separated by semicolons, e.g. Genesis 21:1-34; Numbers 29:1-6.

Kind: global function

ParamType
partsAliyah | Array.<Aliyah>

makeLeyningSummary(aliyot) ⇒ string

Makes a summary of the leyning, like "Genesis 6:9-11:32"

Kind: global function

ParamType
aliyotObject.<string, Aliyah>

hasFestival(holiday) ⇒ boolean

Is there a special festival Torah Reading for holiday?

Kind: global function

ParamType
holidaystring

lookupFestival(holiday) ⇒ any

Returns the raw metadata for festival reading for holiday

Kind: global function

ParamType
holidaystring

getLeyningKeyForEvent(ev, il) ⇒ 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

ParamTypeDefaultDescription
evEventevent
ilbooleanfalsetrue if Israel holiday scheme

specialReadings2(parsha, hd, il, aliyot) ⇒ SpecialReading

Determines if the regular parashat haShavua coincides with an event that requires a special maftir or Haftara (for example Shabbat HaGadol, Shabbat Chanukah, Rosh Chodesh or Machar Chodesh, etc.).

This function does not modify aliyot. Instead, it returns a deep copy with aliyot['M'] replaced and sets reason.M (and in some cases the 6th and 7th aliyah, setting reason['7']).

If a special Haftarah applies, the result will have a haft property pointing to Haftarah object and sets reason.haftara.

Kind: global function

ParamType
parshaArray.<string>
hdHDate
ilboolean
aliyotObject.<string, Aliyah>

getLeyningForHolidayKey(key, cholHaMoedDay, il) ⇒ 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

ParamTypeDescription
keystringname from holiday-readings.json to find
cholHaMoedDaynumber
ilboolean

getLeyningForHoliday(ev, il) ⇒ 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

ParamTypeDefaultDescription
evEventthe Hebcal event associated with this leyning
ilbooleanfalsetrue if Israel holiday scheme

makeLeyningNames(parsha) ⇒ LeyningNames

Transliterated English and Hebrew names of this parsha

Kind: global function

ParamTypeDescription
parshastring | Array.<string>untranslated name like 'Pinchas' or 'Pinchas' or 'Matot','Masei'

getWeekdayReading(parsha) ⇒ Object.<string, Aliyah>

Looks up Monday/Thursday aliyot for a regular parsha

Kind: global function
Returns: Object.<string, Aliyah> - map of aliyot

ParamTypeDescription
parshastring | Array.<string>untranslated name like 'Pinchas' or 'Pinchas' or 'Matot','Masei'

getLeyningForParsha(parsha) ⇒ Leyning

Looks up regular leyning for a weekly parsha with no special readings

Kind: global function
Returns: Leyning - map of aliyot

ParamTypeDescription
parshastring | Array.<string>untranslated name like 'Pinchas' or 'Pinchas' or 'Matot','Masei'

getLeyningForParshaHaShavua(ev, il) ⇒ Leyning

Looks up leyning for a regular Shabbat parsha, including any special maftir or Haftara.

Kind: global function
Returns: Leyning - map of aliyot

ParamTypeDefaultDescription
evEventthe Hebcal event associated with this leyning
ilbooleanfalsein Israel

lookupParsha(parsha) ⇒ ParshaMeta

Returns the parsha metadata

Kind: global function

ParamTypeDescription
parshastring | Array.<string>untranslated name like 'Pinchas' or 'Pinchas' or 'Matot','Masei'

getLeyningOnDate(hdate, il, wantarray) ⇒ Leyning | Array.<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 | Array.<Leyning> - map of aliyot

ParamTypeDefaultDescription
hdateHDateHebrew Date
ilbooleanin Israel
wantarraybooleanfalseto return an array of 0 or more readings

writeCsvLines(stream, ev, reading, il, isParsha)

Formats reading for CSV

Kind: global function

ParamType
streamfs.WriteStream
evEvent
readingLeyning
ilboolean
isParshaboolean

Aliyah : Object

Represents an aliyah

Kind: global typedef
Properties

NameTypeDescription
kstringBook (e.g. "Numbers")
bstringbeginning verse (e.g. "28:9")
estringending verse (e.g. "28:15")
vnumbernumber of verses
pnumberparsha number (1=Bereshit, 54=Vezot HaBracha)

SpecialReading : Object

Leyning for a parsha hashavua or holiday

Kind: global typedef
Properties

NameTypeDescription
aliyotObject.<string, Aliyah>Map of aliyot 1 through 7 plus M for maftir
reasonObject.<string, string>Explanations for special readings, keyed by aliyah number, M for maftir or haftara for Haftarah
haftAliyah | Array.<Aliyah>Haftarah object(s)
sephAliyah | Array.<Aliyah>Haftarah object(s)

LeyningNames : Object

Name of the parsha hashavua or holiday

Kind: global typedef
Properties

NameTypeDescription
enstringEnglish
hestringHebrew (with nikud)

Leyning : Object

Leyning for a parsha hashavua or holiday

Kind: global typedef
Properties

NameTypeDescription
nameLeyningNames
parshaArray.<string>An array of either 1 (regular) or 2 (doubled parsha). undefined for holiday readings
parshaNumnumber | Array.<number>1 for Bereshit, 2 for Noach, etc. undefined for holiday readings
summarystringSuch as Genesis 1:1 - 6:8
haftAliyah | Array.<Aliyah>Haftarah object(s)
haftarastringHaftarah, such as Isaiah 42:5 – 43:11
haftaraNumVnumberNumber of verses in the Haftarah
sephAliyah | Array.<Aliyah>Haftarah object(s) for Sephardim
sephardicstringHaftarah for Sephardim, such as Isaiah 42:5 - 42:21
sephardicNumVnumberNumber of verses in the Haftarah for Sephardim
fullkriyahObject.<string, Aliyah>Map of aliyot 1 through 7 plus M for maftir
weekdayObject.<string, Aliyah>Optional map of weekday Torah Readings aliyot 1 through 3 for Monday and Thursday
reasonObject.<string, string>Explanations for special readings, keyed by aliyah number, M for maftir or haftara for Haftarah
megillahObject.<string, Aliyah>Optional map of megillah reading. Song of Songs is read on the sabbath of Passover week, the Book of Ruth on Shavuot, Lamentations on Tisha be-Av, Ecclesiastes on the sabbath of the week of Sukkoth, and the Book of Esther on Purim.

ParshaMeta : Object

Parsha metadata

Kind: global typedef
Properties

NameTypeDescription
numnumber1 for Bereshit, 2 for Noach, etc. undefined for holiday readings
hebrewstringparsha name in Hebrew with niqud
booknumber1 for Genesis, 2 for Exodus, 5 for Deuteronomy
haftAliyah | Array.<Aliyah>Haftarah object(s)
sephAliyah | Array.<Aliyah>Haftarah object(s) for Sephardim
fullkriyahObject.<string, Array.<string>>Map of aliyot 1 through 7 plus M for maftir
weekdayObject.<string, Array.<string>>Map of weekday Torah Readings aliyot 1 through 3 for Monday and Thursday
8.1.9

2 days ago

8.1.8

1 month ago

8.1.7

2 months ago

8.1.6

2 months ago

8.1.5

3 months ago

8.1.4

4 months ago

8.1.3

4 months ago

8.1.2

4 months ago

8.1.1

4 months ago

8.1.0

5 months ago

8.0.1

5 months ago

7.4.4

8 months ago

7.4.3

8 months ago

7.4.2

8 months ago

7.4.5

7 months ago

8.0.0

5 months ago

7.3.1

12 months ago

7.4.1

12 months ago

7.4.0

12 months ago

7.3.2

12 months ago

7.3.0

12 months ago

7.1.0

1 year ago

7.2.1

1 year ago

7.2.0

1 year ago

6.2.4

1 year ago

6.2.3

1 year ago

7.0.0

1 year ago

7.0.1

1 year ago

6.2.1

2 years ago

6.2.0

2 years ago

6.2.2

2 years ago

5.1.0

2 years ago

6.1.0

2 years ago

6.1.1

2 years ago

5.2.0

2 years ago

5.0.0

2 years ago

6.0.1

2 years ago

6.0.0

2 years ago

6.0.3

2 years ago

6.0.2

2 years ago

6.0.4

2 years ago

4.20.0

2 years ago

4.20.1

2 years ago

4.18.1

2 years ago

4.14.5

2 years ago

4.18.2

2 years ago

4.14.6

2 years ago

4.14.1

2 years ago

4.16.0

2 years ago

4.14.2

2 years ago

4.14.3

2 years ago

4.18.0

2 years ago

4.14.0

2 years ago

4.19.0

2 years ago

4.19.1

2 years ago

4.15.0

2 years ago

4.15.1

2 years ago

4.17.0

2 years ago

4.15.2

2 years ago

4.13.4

2 years ago

4.13.2

2 years ago

4.13.3

2 years ago

4.13.0

2 years ago

4.13.1

2 years ago

4.10.5

2 years ago

4.12.0

2 years ago

4.12.1

2 years ago

4.11.0

2 years ago

4.10.3

2 years ago

4.10.1

3 years ago

4.10.2

2 years ago

4.10.0

3 years ago

4.9.2

3 years ago

4.9.1

3 years ago

4.9.0

3 years ago

4.8.4

3 years ago

4.8.1

3 years ago

4.8.3

3 years ago

4.8.2

3 years ago

4.8.0

3 years ago

4.7.2

3 years ago

4.7.1

3 years ago

4.7.0

3 years ago

4.6.2

3 years ago

4.5.0

3 years ago

4.6.1

3 years ago

4.6.0

3 years ago

4.4.0

3 years ago

4.3.0

3 years ago

4.2.0

3 years ago

4.1.0

3 years ago

4.0.0

3 years ago

3.5.0

3 years ago

3.4.0

3 years ago

3.3.3

4 years ago

3.3.2

4 years ago

3.3.1

4 years ago

3.3.0

4 years ago

3.2.0

4 years ago

3.1.0

4 years ago

3.0.0

4 years ago

2.3.0

4 years ago

2.2.2

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago