UNPKG

@hebcal/leyning

Version:

Torah Reading API for Parashat HaShavua and holidays

55 lines (54 loc) 2.1 kB
import { Aliyah, TanakhBook, TorahBook } from './types'; /** * Names of the books of the Torah. * * `BOOK[1] === 'Genesis'` * @readonly */ export declare const BOOK: TorahBook[]; /** * The number of verses in each book of the Tanakh. * Indexed by English transliterated name of book, * and arrays are 1-based. * * There are 51 chapters in Genesis, so * `NUM_VERSES['Genesis'].length === 51`. * * There are 26 verses in Genesis chapter 4, * so `NUM_VERSES['Genesis'][4] === 26`. * @readonly */ export declare const NUM_VERSES: Record<string, readonly number[]>; /** * Formats parsha as a string * @param parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei'] */ export declare function parshaToString(parsha: string | string[]): string; /** * 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. */ export declare function calculateNumVerses(aliyah: Aliyah): number; /** * Finds the number of verses between two locations in the same book. * @param book The English name of the book (e.g. "Numbers") * @param from The starting verse (e.g. "28:9") * @param to The ending verse (e.g. "28:15") * @returns The number of verses between the two locations, excluding the `to` verse. */ export declare function subtractVerses(book: TanakhBook, from: string, to: string): number; /** * Calculates the next verse after adding a number of verses to a given location. * @param book The English name of the book (e.g. "Numbers") * @param from The starting verse (e.g. "28:9") * @param numVerses The number of verses to add; must be nonnegative. * @returns The next verse after adding the specified number of verses, * or null if the resulting verse exceeds the number of verses * in the book. */ export declare function addVerses(book: TanakhBook, from: string, numVerses: number): string | null; /** * Formats an aliyah object like "Numbers 28:9-28:15" */ export declare function formatAliyahWithBook(a: Aliyah): string;