quran-meta
Version:
Library with meta data and functionality related to Holy Quran
10 lines (9 loc) • 315 B
JavaScript
import { RukuList } from "./lists/rukuList.mjs";
import { binarySearch } from "./utils.mjs";
import { checkValidAyahId } from "./validation.mjs";
export function findRukuByAyahId(ayahId) {
checkValidAyahId(ayahId);
const jj = binarySearch(RukuList, ayahId);
const juz = jj < 0 ? -jj - 2 : jj;
return juz;
}