UNPKG

quran-meta

Version:

Library with meta data and functionality related to Holy Quran

28 lines (26 loc) 1.28 kB
const require_findSurahAyahByAyahId = require('./findSurahAyahByAyahId.cjs'); const require_getThumunAlHizb = require('./getThumunAlHizb.cjs'); //#region src/getThumunAlHizbMeta.ts /** * Retrieves the metadata for a specific quarter (rub' al-hizb) of the Quran. * * @param eighthIndex - The index of the Eighth (thumun' 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 getThumunAlHizbMeta(eighthIndex, data) { const res = require_getThumunAlHizb.getThumunAlHizb(eighthIndex); const HizbEighthList = data.HizbEighthList; if (!HizbEighthList) throw new Error(`Riwaya ${data.meta.riwayaName} does not have Hizb Eighth List data.`); const [firstAyahId, nextJuzAyahId] = [HizbEighthList[eighthIndex], HizbEighthList[eighthIndex + 1]]; const lastAyahId = nextJuzAyahId - 1; return { firstAyahId, lastAyahId, first: require_findSurahAyahByAyahId.findSurahAyahByAyahId(firstAyahId, data), last: require_findSurahAyahByAyahId.findSurahAyahByAyahId(lastAyahId, data), ...res }; } //#endregion exports.getThumunAlHizbMeta = getThumunAlHizbMeta;