@orthodox-union/shnayimmikrah
TypeScript icon, indicating that this package has built-in type declarations

0.8.0 • Public • Published

Shnayim Mikrah

This project serves as a wrapper over the Sefaria api to enable presenting Shnayim Mikrah text by Aliyah.

On-line Support

Request

The following arguments can be set to control what data is returned:

interface Args {
  /**
   * Used to determine what date we need to look at in order to return the correct Aliyah
   * Must be a valid IANA time zone string, such as Asia/Jerusalem, America/New_York, Europe/Paris, etc.
   */
  timezone: string;
  /**
   * Used to specify if you want the parasha according to the diaspora calendar or according to the Israel calendar. 
   * Default is diaspora=1 to get the diaspora version.
   */
  diaspora?: number;
  /**
   * Used to control what ALiyah is returned. Default is the Aliyah for the day of the week.
   */
  aliyah?: 1 | 2 | 3 | 4 | 5 | 6 | 7; 

	/**
	 * What version should be used for the Hebrew text
	 */
	hebrewTextVersion: HebrewTextVersionOptions;
	
	/**
	 * What version should be used for the English text
	 */
	englishTextVersion: EnglishTextVersionOptions;
}
import getShnayimMikrah from '@orthodox-union/shnayimmikrah';

// This will return the Shnayim Mikrah for todays aliyah as would be leined in the America/New_York timezone.
await getShnayimMikrah({
  timezone: 'America/New_York'
});

Response

The data returned will have the following shape:

interface Aliyah {
    book: 'Genesis' | 'Exodus' | 'Leviticus' | 'Numbers' | 'Deuteronomy';
    aliyah: 1 | 2 | 3 | 4 | 5 | 6 | 7;
    verseRange: string; // Genesis 30:14-30:27
    verses: Array<{
      book: 'Genesis' | 'Exodus' | 'Leviticus' | 'Numbers' | 'Deuteronomy';
      chapter: number;
      verse: number;
      hebrewText: string;
      englishText: string;
      targum: string;
      rashi: string[];
    }>;
}

Off-line Support

Download

To download the data, you have the following options

interface DownloadArgs {
	/**
	 * Should the entire Chumash be download.
	 * Will take predence over `book`
	 */
	all: boolean;
	/**
	 * The Book you want to download.
	 */
	book: BookName;
	/**
	 * How the data should be stored
	 * @param {data} data The data being saved
	 */
	save: (data: OfflineStorage) => void;
	/**
	 * What version should be used for the Hebrew text
	 */
	hebrewTextVersion: HebrewTextVersionOptions;
	
	/**
	 * What version should be used for the English text
	 */
	englishTextVersion: EnglishTextVersionOptions;
}

Request

interface OfflineArgs {
	/**
   * Tells the package how to get the data.
   */
  getData: (book: BookName) => Promise<OfflineStorage>;
  /**
   * The book the Parsha is in.
   * Used in the getData function
   */
  book: BookName;
	/**
   * The Parsha to return.
   */
	parsha: ParshaName;
	/**
   * Used to control what ALiyah is returned. Default is the Aliyah for the day of the week.
   */
	aliyah?: AliyahNumber;
	/**
   * If true, the entire Parsha of the week will be returned.
   */
	wholeParsha?: boolean;
}

Response

If you request a single Aliyah, the response will be the same as offline support.

Otherwise you will get the entire Parsha:

interface Parsha {
	name: ParshaName;
	book: BookName;
	fullRef: string;
	aliyot: Aliyah[];
}

Readme

Keywords

Package Sidebar

Install

npm i @orthodox-union/shnayimmikrah

Weekly Downloads

132

Version

0.8.0

License

MIT

Unpacked Size

123 kB

Total Files

33

Last publish

Collaborators

  • mordzuber