UNPKG

quran-meta

Version:

Library with meta data and functionality related to Holy Quran

10 lines (9 loc) 317 B
import { PageList } from "./lists/pageList.mjs"; import { binarySearch } from "./utils.mjs"; import { checkValidAyahId } from "./validation.mjs"; export function findPagebyAyahId(ayahId) { checkValidAyahId(ayahId); const jj = binarySearch(PageList, ayahId); const page = jj < 0 ? -jj - 2 : jj; return page; }