quran-meta
Version:
Library with meta data and functionality related to Holy Quran
14 lines (12 loc) • 729 B
text/typescript
import { getRubAlHizb } from "./getRubAlHizb"
import type { RubAlHizbId, ThumunAlHizb, ThumunAlHizbId } from "./types"
/**
* Retrieves the basic metadata for a specific Eighth (thumun' al-hizb) of the Quran.
*
* @param eighthIndex - The index of the Eighth (thumun' al-hizb) to retrieve metadata for, where 1 is the first quarter.
* @returns An object containing the metadata for the specified quarter, including the juz' (part), hizb (section), and the quarter (rub' al-hizb) index.
*/
export function getThumunAlHizb(eighthIndex: ThumunAlHizbId): ThumunAlHizb {
const rubAlHizb = getRubAlHizb((Math.floor((eighthIndex - 1) / 2) + 1) as RubAlHizbId)
return { ...rubAlHizb, thumunAlHizbId: eighthIndex }
}