UNPKG

quran-meta

Version:

Library with meta data and functionality related to Holy Quran

20 lines (18 loc) 736 B
const require_validation = require('./validation.cjs'); const require_utils = require('./utils.cjs'); //#region src/findRubAlHizbByAyahId.ts /** * Finds the Maqra/Rub-al-Hizb of the Quran that contains the given Ayah (verse) ID. * * @param ayahId - The ID of the Ayah (verse) to find the Juz for. * @param lists - The Lists object for the riwaya. * @returns The Maqra of the Quran that contains the given Ayah ID. */ function findRubAlHizbByAyahId(ayahId, data) { require_validation.checkValidAyahId(ayahId, data.meta); const HizbQuarterList = data.HizbQuarterList; const jj = require_utils.binarySearch(HizbQuarterList, ayahId); return jj < 0 ? -jj - 2 : jj; } //#endregion exports.findRubAlHizbByAyahId = findRubAlHizbByAyahId;