@sahabaplus/mushaf-engine
Version:
TypeScript implementation of a Quran Mushaf navigation engine
82 lines (81 loc) • 2.2 kB
TypeScript
import { Verse } from "../mushaf";
/**
* Represents a position in the Quran by sura and verse number.
*
* This class provides a type-safe way to represent verse positions
* and enables better API design for navigation operations.
*/
export declare class VersePosition {
private readonly sura;
private readonly verse;
/**
* Create a new VersePosition
*
* @param sura - Sura number (1-114)
* @param verse - Verse number within the sura (1-286)
*/
constructor(sura: number, verse: number);
/**
* Create a new VersePosition for the start of the Mushaf
*
* @returns VersePosition for (1, 1) - Al-Fatiha, verse 1
*/
static start(): VersePosition;
/**
* Create a new VersePosition for the end of the Mushaf
*
* @returns VersePosition for (114, 6) - An-Nas, verse 6
*/
static end(): VersePosition;
/**
* Get the sura number
*
* @returns The sura number
*/
getSura(): number;
/**
* Get the verse number
*
* @returns The verse number
*/
getVerse(): number;
/**
* Get the position as a tuple
*
* @returns Tuple of [sura, verse]
*/
getTuple(): [number, number];
/**
* Convert to the start of the same sura (verse 1)
*
* @returns A new VersePosition at the start of the same sura
*/
toStartOfSura(): VersePosition;
/**
* Check if this position equals another VersePosition
*
* @param other - Other VersePosition to compare
* @returns True if positions are equal
*/
equals(other: VersePosition): boolean;
/**
* Check if this position equals a Verse object
*
* @param verse - Verse object to compare
* @returns True if position matches the verse
*/
equalsVerse(verse: Verse): boolean;
/**
* Convert to string representation
*
* @returns String representation of the position
*/
toString(): string;
/**
* Create a VersePosition from a Verse object
*
* @param verse - Verse object to convert
* @returns New VersePosition
*/
static fromVerse(verse: Verse): VersePosition;
}