UNPKG

quran-meta

Version:

Library with meta data and functionality related to Holy Quran

22 lines (20 loc) 719 B
//#region src/getRubAlHizb.ts /** * Retrieves the basic 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. * @returns An object containing the metadata for the specified quarter, including the juz' (part), hizb (section), and the quarter (rub' al-hizb) index. */ function getRubAlHizb(quarterIndex) { const juz = Math.floor((quarterIndex - 1) / 8) + 1; const hizbIndex = Math.floor((quarterIndex - 1) / 4) + 1; const juzPart = quarterIndex % 8 || 8; return { juz, hizbId: hizbIndex, juzPart, rubAlHizbId: quarterIndex }; } //#endregion exports.getRubAlHizb = getRubAlHizb;