quran-meta
    Preparing search index...

    Class QuranRiwaya<R>

    QuranRiwaya class provides a clean API for Quran metadata operations with a specific riwaya (recitation tradition) context.

    Currently provides basic Surah and Ayah operations. For advanced features like Juz, Page, Manzil, RubAlHizb, etc., use the functional API directly.

    Basic Usage with Hafs

    import { quran } from 'quran-meta/hafs'

    const surahMeta = quran.getSurahMeta(2) // Get Al-Baqarah metadata
    const ayahCount = quran.getAyahCountInSurah(2) // 286 ayahs
    const [surah, ayah] = quran.findSurahAyahByAyahId(100) // [2, 93]

    Working with Qalun

    import { quran } from 'quran-meta/qalun'

    const meta = quran.meta
    console.log(meta.numAyahs) // 6214 (Qalun has fewer ayahs than Hafs)

    Creating a custom instance

    import { QuranRiwaya } from 'quran-meta'
    import { WarshMeta, WarshLists } from 'quran-meta/lists/WarshLists'

    const warsh = QuranRiwaya.create(WarshLists)

    Type Parameters

    • R extends RiwayaName = "Hafs"
    Index

    Accessors

    • get lists(): Riwayas[R]

      Gets the metadata for this riwaya

      Returns Riwayas[R]

    Methods

    • Finds the juz number for a given ayah ID

      Parameters

      • ayahId: number

      Returns Juz

    • Finds the manzil number for a given ayah ID

      Parameters

      • ayahId: number

      Returns Manzil

    • Finds the page number for a given ayah ID

      Parameters

      • ayahId: number

      Returns Page

    • Finds the ruku number for a given ayah ID

      Parameters

      • ayahId: number

      Returns Ruku

    • Finds the surah number for a given ayah ID

      Parameters

      • ayahId: number

      Returns Surah

    • Finds the ThumunAlHizb ID for a given ayah ID (Qalun/Warsh only)

      Parameters

      Returns ThumunAlHizbId | null

    • Finds the ThumunAlHizb ID for a given ayah ID (Qalun/Warsh only)

      Parameters

      • ayahId: number

      Returns ThumunAlHizbId | null

    • Type Parameters

      • P extends "page" | "juz" | "surah" | "ruku" | "rubAlHizb" | "thumunAlHizb" | "manzil"

      Parameters

      • type: P

      Returns PartBlock[] | null

    • Gets the count of ayahs in a surah

      Parameters

      Returns number

    • Type Parameters

      • P extends "page" | "juz" | "surah" | "ruku" | "rubAlHizb" | "thumunAlHizb" | "manzil"

      Parameters

      • type: P

      Returns PartBlock[]

    • Parameters

      • eighthIndex: ThumunAlHizbId

      Returns ThumunAlHizb | null

    • Parameters

      • ayahId: number

      Returns ThumunAlHizb | null

    • Gets metadata for a specific ThumunAlHizb (Qalun/Warsh only)

      Parameters

      • eighthIndex: ThumunAlHizbId

      Returns ThumunAlHizbMeta | null

    • Parameters

      • ayahId: number

      Returns ThumunAlHizb | null

    • Checks if an ayah is the first ayah of a juz

      Parameters

      • ayahId: number

      Returns number

    • Checks if an ayah is the first ayah of a page

      Parameters

      • ayahId: number

      Returns number

    • Parameters

      • x: unknown

      Returns x is number

    • Parameters

      • str: string
      • isStrict: boolean = false

      Returns number

    • Create a QuranRiwaya instance with the specified riwaya, metadata, and lists

      Type Parameters

      • R extends "Hafs" | "Qalun" | "Warsh"

      Parameters

      • rData: Riwayas[R]

        The Lists object for this riwaya

      Returns QuranRiwaya<R>

    • Parameters

      • str: string

      Returns { ayah?: number; ayahTo?: number; surahOrAyah?: number } | null