Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hebcal/leyning

Package Overview
Dependencies
Maintainers
1
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hebcal/leyning

Javascript Torah Reading API for Parashat HaShavua and holidays

  • 4.9.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
488
increased by80.07%
Maintainers
1
Weekly downloads
 
Created
Source

@hebcal/leyning

Javascript Torah Reading API for Parashat HaShavua and holidays

Build Status

Installation

$ npm install @hebcal/leyning

Synopsis

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}`);
}

Classes

Triennial

Triennial Torah readings

Constants

BOOK

Names of the books of the Torah. BOOK[1] === 'Genesis'

Functions

addSefariaLinksToLeyning(aliyot, showBook)

Makes Sefaria links by adding href, verses and num attributes to each aliyah. CAUTION: Modifies the aliyot parameter instead of making a copy.

getLeyningKeyForEvent(e, [il])string

Based on the event date, type and title, finds the relevant leyning key

getLeyningForHoliday(e, [il])Leyning

Looks up leyning for a given holiday. Returns some of full kriyah aliyot, special Maftir, special Haftarah

makeLeyningSummary(aliyot)string
getLeyningForHolidayKey(key)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

getHaftaraKey(parsha)string

on doubled parshiot, read only the second Haftarah except for Nitzavim-Vayelech

getChanukahShabbatKey(e, key)string
getHolidayEvents(hd, il)Array.<Event>

Filters out Rosh Chodesh and events that don't occur in this location

getLeyningForParsha(parsha)Leyning

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

getLeyningForParshaHaShavua(ev, [il])Leyning

Looks up leyning for a regular Shabbat parsha.

formatAliyahWithBook(a)string

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

formatAliyahShort(aliyah, showBook)string

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

getDoubledName(id)string

takes a 0-based (Bereshit=0) parsha ID

getTriennial(year)Triennial

Calculates the 3-year readings for a given year

getTriennialForParshaHaShavua(ev, [context])TriennialAliyot | Object.<string, Aliyah>

Looks up the triennial leyning for this Parashat HaShavua

Typedefs

Aliyah : Object

Represents an aliyah

Leyning : Object

Leyning for a parsha hashavua or holiday

TriennialAliyot : Object

Represents triennial aliyot for a given date

Triennial

Triennial Torah readings

Kind: global class

new Triennial([hebrewYear])

Builds a Triennial object

ParamTypeDescription
[hebrewYear]numberHebrew Year (default current year)

triennial.getReading(parsha, yearNum) ⇒ Object.<string, Aliyah>

Kind: instance method of Triennial
Returns: Object.<string, Aliyah> - a map of aliyot 1-7 plus "M"

ParamTypeDescription
parshastringparsha name ("Bereshit" or "Achrei Mot-Kedoshim")
yearNumnumber0 through 2 for which year of Triennial cycle

triennial.getStartYear() ⇒ number

Kind: instance method of Triennial

Triennial.getYearNumber(year) ⇒ number

Returns triennial year 1, 2 or 3 based on this Hebrew year

Kind: static method of Triennial

ParamTypeDescription
yearnumberHebrew year

Triennial.getCycleStartYear(year) ⇒ number

Returns Hebrew year that this 3-year triennial cycle began

Kind: static method of Triennial

ParamTypeDescription
yearnumberHebrew year

BOOK

Names of the books of the Torah. BOOK[1] === 'Genesis'

Kind: global constant

addSefariaLinksToLeyning(aliyot, showBook)

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

ParamTypeDescription
aliyotObject.<string, Aliyah>aliyah map to decorate
showBookbooleandisplay the book name in the verses field (e.g. for special Maftir)

getLeyningKeyForEvent(e, [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
eEventevent
[il]booleanfalsetrue if Israel holiday scheme

getLeyningForHoliday(e, [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
eEventthe Hebcal event associated with this leyning
[il]booleanfalsetrue if Israel holiday scheme

makeLeyningSummary(aliyot) ⇒ string

Kind: global function

ParamType
aliyotObject.<string, Aliyah>

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

getHaftaraKey(parsha) ⇒ string

on doubled parshiot, read only the second Haftarah except for Nitzavim-Vayelech

Kind: global function

ParamType
parshaArray.<string>

getChanukahShabbatKey(e, key) ⇒ string

Kind: global function

ParamType
eEvent
keystring

getHolidayEvents(hd, il) ⇒ Array.<Event>

Filters out Rosh Chodesh and events that don't occur in this location

Kind: global function

ParamTypeDescription
hdHDateHebrew date
ilbooleanin Israel

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.

Kind: global function
Returns: Leyning - map of aliyot

ParamTypeDefaultDescription
evEventthe Hebcal event associated with this leyning
[il]booleanfalsein Israel

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

getDoubledName(id) ⇒ string

takes a 0-based (Bereshit=0) parsha ID

Kind: global function

ParamType
idnumber

getTriennial(year) ⇒ Triennial

Calculates the 3-year readings for a given year

Kind: global function

ParamTypeDescription
yearnumberHebrew year

getTriennialForParshaHaShavua(ev, [context]) ⇒ 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"

ParamTypeDefaultDescription
evEvent
[context]booleanfalsereturns a reading wrapper object which includes date, yearNum and aliyot

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")
[v]numbernumber of verses
[p]numberparsha number (1=Bereshit, 54=Vezot HaBracha)

Leyning : Object

Leyning for a parsha hashavua or holiday

Kind: global typedef
Properties

NameTypeDescription
summarystring
haftarastringHaftarah
sephardicstringHaftarah for Sephardic
fullkriyahObject.<string, Aliyah>
[reason]Object

TriennialAliyot : Object

Represents triennial aliyot for a given date

Kind: global typedef
Properties

NameTypeDescription
aliyotObject.<string, Aliyah>a map of aliyot 1-7 plus "M"
yearNumnumberyear number, 0-2
dateDateShabbat date for when this parsha is read in this 3-year cycle
[readSeparately]booleantrue if a double parsha is read separately in year yearNum
[date1]DateShabbat date of the first part of a read-separately aliyah pair
[date2]DateShabbat date of the second part of a read-separately aliyah pair

Keywords

FAQs

Package last updated on 30 Sep 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc