UNPKG

quran-meta

Version:

Library with meta data and functionality related to Holy Quran

20 lines (18 loc) 738 B
const require_validation = require('./validation.cjs'); const require_utils = require('./utils.cjs'); const require_hizbQuarterList = require('./lists/hizbQuarterList.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. * @returns The Maqra of the Quran that contains the given Ayah ID. */ function findRubAlHizbByAyahId(ayahId) { require_validation.checkValidAyahId(ayahId); const jj = require_utils.binarySearch(require_hizbQuarterList.HizbQuarterList, ayahId); const page = jj < 0 ? -jj - 2 : jj; return page; } //#endregion exports.findRubAlHizbByAyahId = findRubAlHizbByAyahId;