Function isValidSurahAyah

  • Type guard function that checks if a tuple of two numbers represents a valid Surah and Ayah combination.

    Parameters

    • x: [unknown, unknown]

      A tuple containing [surahNumber, ayahNumber]

    Returns x is SurahAyah

    True if the tuple represents a valid Surah-Ayah combination, false otherwise

    isValidSurahAyah([1, 7]) // true - Al-Fatiha has 7 ayahs
    isValidSurahAyah([1, 8]) // false - Al-Fatiha only has 7 ayahs
    isValidSurahAyah([115, 1]) // false - there are only 114 surahs