UNPKG

quran-meta

Version:

Library with meta data and functionality related to Holy Quran

20 lines (18 loc) 867 B
import { checkValidSurah } from "./validation.mjs"; import { findAyahIdBySurah } from "./findAyahIdBySurah.mjs"; import { findRubAlHizbByAyahId } from "./findRubAlHizbByAyahId.mjs"; //#region src/findRubAlHizb.ts /** * Finds the Juz (part) and Rub-ul-Hizb/Maqra (quarter section) of the Quran that the given Ayah (verse) belongs to. * * @param surah - The Surah (chapter) number. * @param ayah - The Ayah (verse) number. Defaults to 1 if not provided. * @param data - The Lists object containing SurahList and HizbQuarterList. * @returns An object containing the Juz (part) number, Hizb (section) number, and the index of the Hizb that the given Ayah belongs to. */ function findRubAlHizb(surah, ayah = 1, data) { checkValidSurah(surah, data.meta); return findRubAlHizbByAyahId(findAyahIdBySurah(surah, ayah, data), data); } //#endregion export { findRubAlHizb };