quran-meta
Version:
Library with meta data and functionality related to Holy Quran
27 lines (25 loc) • 1.04 kB
JavaScript
import { findSurahAyahByAyahId } from "./findSurahAyahByAyahId.mjs";
import { getRubAlHizb } from "./getRubAlHizb.mjs";
//#region src/getRubAlHizbMeta.ts
/**
* Retrieves the metadata for a specific quarter (rub' al-hizb) of the Quran.
*
* @param quarterIndex - The index of the quarter (rub' al-hizb) to retrieve metadata for, where 1 is the first quarter.
* @param data - The Lists object for the riwaya.
* @returns An object containing the metadata for the specified quarter, including the juz' (part), hizb (section), and the quarter (rub' al-hizb) index.
*/
function getRubAlHizbMeta(quarterIndex, data) {
const res = getRubAlHizb(quarterIndex);
const HizbQuarterList = data.HizbQuarterList;
const [firstAyahId, nextJuzAyahId] = [HizbQuarterList[quarterIndex], HizbQuarterList[quarterIndex + 1]];
const lastAyahId = nextJuzAyahId - 1;
return {
firstAyahId,
lastAyahId,
first: findSurahAyahByAyahId(firstAyahId, data),
last: findSurahAyahByAyahId(lastAyahId, data),
...res
};
}
//#endregion
export { getRubAlHizbMeta };