quran-meta
Version:
Library with meta data and functionality related to Holy Quran
20 lines (18 loc) • 635 B
JavaScript
import { checkValidAyahId } from "./validation.mjs";
import { binarySearch } from "./utils.mjs";
//#region src/isAyahJuzFirst.ts
/**
* Returns the Juz (part) number that the given Ayah (verse) belongs to.
*
*
* @param ayahId - The Ayah Id (verse) number.
* @param data - The Lists object for the riwaya.
* @returns The Juz (part) number that the given Ayah belongs to. Returns Positive number if ayah is first ayah of juz, number is juz number
*/
function isAyahJuzFirst(ayahId, data) {
const { JuzList, meta } = data;
checkValidAyahId(ayahId, meta);
return binarySearch(JuzList, ayahId);
}
//#endregion
export { isAyahJuzFirst };