quran-meta
Version:
Library with meta data and functionality related to Holy Quran
19 lines (17 loc) • 559 B
JavaScript
import { checkValidAyahId } from "./validation.mjs";
import { binarySearch } from "./utils.mjs";
//#region src/isAyahPageFirst.ts
/**
* Determines if the given ayah is the first ayah of a juz.
*
* @param ayahId - The ayah id .
* @param data - The Lists object for the riwaya.
* @returns The page number if the ayah is the first ayah of the page, otherwise -1.
*/
function isAyahPageFirst(ayahId, data) {
checkValidAyahId(ayahId, data.meta);
const PageList = data.PageList;
return binarySearch(PageList, ayahId);
}
//#endregion
export { isAyahPageFirst };