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

    QuranRiwaya.create() takes a Lists object (SurahList, JuzList, PageList, etc. plus meta) shaped like the built-in Hafs/Qalun/Warsh data - see the implementations in src/lists/ as a reference for the required structure.

    import { QuranRiwaya } from 'quran-meta'

    const custom = QuranRiwaya.create(myCustomLists)

    Type Parameters

    Index
    • 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

    • 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[]

    • Gets RubAlHizb data (juz, hizb, etc.) for a given ayah ID

      Parameters

      • ayahId: number

      Returns RubAlHizb

    • 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

    • Checks if a surah-ayah combination is the first ayah of a juz

      Parameters

      Returns number

    • Checks if a surah-ayah combination is the first ayah of a page

      Parameters

      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 "Bazzi" | "Douri" | "Hafs" | "Qalun" | "Qunbul" | "Shuba" | "Sousi" | "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