Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

quran-meta

Package Overview
Dependencies
Maintainers
0
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quran-meta - npm Package Compare versions

Comparing version 3.0.1-7 to 3.0.1-8

lib_cjs/ayahStringSplitter.cjs

24

dist/index.d.ts

@@ -74,3 +74,3 @@ type QuranMeta = {

*/
declare function ayaStringSplitter(str: string): SurahAyahSegment;
declare function ayahStringSplitter(str: string): SurahAyahSegment;

@@ -83,3 +83,3 @@ /**

*/
declare function findAyaidBySurah(surah: Surah, ayah: AyahNo): AyahId;
declare function findAyahIdBySurah(surah: Surah, ayah: AyahNo): AyahId;

@@ -116,6 +116,6 @@ /**

*
* @param ayaId - The ID of the Ayah (verse) to find the Juz for.
* @param ayahId - The ID of the Ayah (verse) to find the Juz for.
* @returns The Juz (part) of the Quran that contains the given Ayah ID.
*/
declare function findJuzByAyaid(ayaId: AyahId): Juz;
declare function findJuzByAyahId(ayahId: AyahId): Juz;

@@ -165,6 +165,6 @@ /**

*
* @param ayaId - The ID of the Ayah (verse) to find the Juz for.
* @param ayahId - The ID of the Ayah (verse) to find the Juz for.
* @returns The Maqra of the Quran that contains the given Ayah ID.
*/
declare function findRubAlHizbByAyaid(ayaId: AyahId): Juz;
declare function findRubAlHizbByAyahId(ayahId: AyahId): Juz;

@@ -177,3 +177,3 @@ /**

*/
declare function findSurahByAyaid(ayaId: AyahId): SurahAyah;
declare function findSurahByAyahId(ayaId: AyahId): SurahAyah;

@@ -185,3 +185,3 @@ /**

*/
declare function getAyahCountinSurah(surah: Surah): number;
declare function getAyahCountInSurah(surah: Surah): number;

@@ -217,6 +217,6 @@ /**

*
* @param ayaId - The Ayah ID to find the Juz, Hizb, and Hizb ID for.
* @param ayahId - The Ayah ID to find the Juz, Hizb, and Hizb ID for.
* @returns An object containing the Juz, Hizb, and Hizb ID for the given Ayah ID.
*/
declare function getRubAlHizbMetaByAyaid(ayaId: AyahId): JuzHizb;
declare function getRubAlHizbMetaByAyahId(ayahId: AyahId): JuzHizb;

@@ -238,3 +238,3 @@ /**

* @param ayahMode - If true, the `ayah` parameter is treated as an Ayah ID instead of a Surah and Ayah number.
* @returns The Juz (part) number that the given Ayah belongs to. Returns Positive number if aya is first ayah of juz, number is juz number
* @returns The Juz (part) number that the given Ayah belongs to. Returns Positive number if ayah is first ayah of juz, number is juz number
*/

@@ -313,2 +313,2 @@ declare function isAyahJuzFirst(surah: Surah, ayah: AyahNo, ayahMode?: boolean): Juz;

export { type AyahId, type AyahMeta, type AyahNo, HizbQuarterList, type Juz, type JuzHizb, JuzList, type JuzMeta, ManzilList, type Page, PageList, type PageMeta, type QuranMeta, RukuList, type Sajda, SajdaList, type SajdaType, type Surah, type SurahAyah, type SurahAyahSegment, SurahList, type SurahMeta, type SurahName, ayaStringSplitter, checkValidAyahId, checkValidSurah, checkValidSurahAyah, findAyaidBySurah, findJuz, findJuzAndShift, findJuzByAyaid, findJuzMetaBySurah, findPage, findRangeAroundAyah, findRubAlHizb, findRubAlHizbByAyaid, findSurahByAyaid, getAyahCountinSurah, getAyahMeta, getPageMeta, getRubAlHizbMeta, getRubAlHizbMetaByAyaid, getSurahMeta, isAyahJuzFirst, isAyahPageFirst, meta, nextAyah, prevAyah, surahNames$1 as surahNamesEn, surahNames as surahNamesRu };
export { type AyahId, type AyahMeta, type AyahNo, HizbQuarterList, type Juz, type JuzHizb, JuzList, type JuzMeta, ManzilList, type Page, PageList, type PageMeta, type QuranMeta, RukuList, type Sajda, SajdaList, type SajdaType, type Surah, type SurahAyah, type SurahAyahSegment, SurahList, type SurahMeta, type SurahName, ayahStringSplitter, checkValidAyahId, checkValidSurah, checkValidSurahAyah, findAyahIdBySurah, findJuz, findJuzAndShift, findJuzByAyahId, findJuzMetaBySurah, findPage, findRangeAroundAyah, findRubAlHizb, findRubAlHizbByAyahId, findSurahByAyahId, getAyahCountInSurah, getAyahMeta, getPageMeta, getRubAlHizbMeta, getRubAlHizbMetaByAyahId, getSurahMeta, isAyahJuzFirst, isAyahPageFirst, meta, nextAyah, prevAyah, surahNames$1 as surahNamesEn, surahNames as surahNamesRu };
/*!
* Quran Meta library 3.0.1-7
* Quran Meta library 3.0.1-8
*

@@ -149,3 +149,3 @@ * Released under the MIT license

function getAyahCountinSurah(surah) {
function getAyahCountInSurah(surah) {
return getSurahMeta(surah)[1];

@@ -167,5 +167,5 @@ }

if (!checkValidSurah(surah, checkOnly)) return false;
if (ayah < 1 || ayah > getAyahCountinSurah(surah)) {
if (ayah < 1 || ayah > getAyahCountInSurah(surah)) {
if (checkOnly) return false;
throw new RangeError("Ayah must be between 1 and " + getAyahCountinSurah(surah));
throw new RangeError("Ayah must be between 1 and " + getAyahCountInSurah(surah));
}

@@ -186,3 +186,3 @@ return true;

function ayaStringSplitter(str) {
function ayahStringSplitter(str) {
const [surahStr, ayahsStr] = str.trim().split(":");

@@ -216,3 +216,3 @@ const surah = parseInt(surahStr, 10);

function findAyaidBySurah(surah, ayah) {
function findAyahIdBySurah(surah, ayah) {
checkValidSurahAyah(surah, ayah);

@@ -258,13 +258,13 @@ const [startAyahId] = getSurahMeta(surah);

function findJuzByAyaid(ayaId) {
checkValidAyahId(ayaId);
return JuzList.findIndex((x) => x > ayaId) - 1;
function findJuzByAyahId(ayahId) {
checkValidAyahId(ayahId);
return JuzList.findIndex((x) => x > ayahId) - 1;
}
function findJuz(surah, ayah = 1, ayahMode = false) {
const ayahId = ayahMode ? ayah : checkValidSurahAyah(surah, ayah) && findAyaidBySurah(surah, ayah);
return findJuzByAyaid(ayahId);
const ayahId = ayahMode ? ayah : checkValidSurahAyah(surah, ayah) && findAyahIdBySurah(surah, ayah);
return findJuzByAyahId(ayahId);
}
function findSurahByAyaid(ayaId) {
function findSurahByAyahId(ayaId) {
checkValidAyahId(ayaId);

@@ -276,6 +276,6 @@ const suraNum = SurahList.findIndex((x) => x[0] > ayaId) - 1;

function findJuzAndShift(surah, ayah, ayahMode = false) {
const ayahId = ayahMode ? checkValidAyahId(ayah) && ayah : checkValidSurah(surah) && findAyaidBySurah(surah, ayah);
const juz = findJuzByAyaid(ayahId);
const ayahId = ayahMode ? checkValidAyahId(ayah) && ayah : checkValidSurah(surah) && findAyahIdBySurah(surah, ayah);
const juz = findJuzByAyahId(ayahId);
const leftAyahId = JuzList[juz];
if (ayahMode) [surah] = findSurahByAyaid(ayahId);
if (ayahMode) [surah] = findSurahByAyahId(ayahId);
const [surahStartAyahId] = SurahList[surah];

@@ -296,3 +296,3 @@ return {

let rightJuz = leftjuz;
while (rightJuz < meta.numJuzs && findSurahByAyaid(JuzList[rightJuz + 1])[0] === surah) {
while (rightJuz < meta.numJuzs && findSurahByAyahId(JuzList[rightJuz + 1])[0] === surah) {
rightJuz++;

@@ -919,3 +919,3 @@ }

function findPage(surah, ayah, ayahMode = false) {
const ayahId = ayahMode ? checkValidAyahId(ayah) && ayah : checkValidSurah(surah) && findAyaidBySurah(surah, ayah);
const ayahId = ayahMode ? checkValidAyahId(ayah) && ayah : checkValidSurah(surah) && findAyahIdBySurah(surah, ayah);
return PageList.findIndex((x) => x > ayahId) - 1;

@@ -925,6 +925,6 @@ }

function findRangeAroundAyah(surah, ayah, mode, ayahMode = false) {
const ayahId = ayahMode ? ayah : checkValidSurah(surah) && findAyaidBySurah(surah, ayah);
const ayahId = ayahMode ? ayah : checkValidSurah(surah) && findAyahIdBySurah(surah, ayah);
switch (mode) {
case "juz": {
const juz = findJuzByAyaid(ayahId);
const juz = findJuzByAyahId(ayahId);
return [JuzList[juz], JuzList[juz + 1] - 1];

@@ -1193,5 +1193,5 @@ }

function findRubAlHizbByAyaid(ayaId) {
checkValidAyahId(ayaId);
return HizbQuarterList.findIndex((x) => x > ayaId) - 1;
function findRubAlHizbByAyahId(ayahId) {
checkValidAyahId(ayahId);
return HizbQuarterList.findIndex((x) => x > ayahId) - 1;
}

@@ -1206,5 +1206,5 @@

function getRubAlHizbMetaByAyaid(ayaId) {
checkValidAyahId(ayaId);
const quarterIndex = findRubAlHizbByAyaid(ayaId);
function getRubAlHizbMetaByAyahId(ayahId) {
checkValidAyahId(ayahId);
const quarterIndex = findRubAlHizbByAyahId(ayahId);
return getRubAlHizbMeta(quarterIndex);

@@ -1214,8 +1214,8 @@ }

function findRubAlHizb(surah, ayah = 1, ayahMode = false) {
const ayahId = ayahMode ? ayah : checkValidSurah(surah) && findAyaidBySurah(surah, ayah);
return getRubAlHizbMetaByAyaid(ayahId);
const ayahId = ayahMode ? ayah : checkValidSurah(surah) && findAyahIdBySurah(surah, ayah);
return getRubAlHizbMetaByAyahId(ayahId);
}
const SajdaList = [
// [ayaId, type]
// [ayahId, type]
[1160, "recommended"],

@@ -1241,4 +1241,4 @@ [1722, "recommended"],

throw new RangeError("ayahId must be between 1 and " + meta.numAyahs);
const quarterData = getRubAlHizbMetaByAyaid(ayahId);
const [surah, ayah] = findSurahByAyaid(ayahId);
const quarterData = getRubAlHizbMetaByAyahId(ayahId);
const [surah, ayah] = findSurahByAyahId(ayahId);
const page = findPage(-1, ayahId, true);

@@ -1279,4 +1279,4 @@ const isSajdahAyah = SajdaList.some(([sajdaAyahId]) => sajdaAyahId === ayahId);

pageNum,
first: findSurahByAyaid(curPage),
last: [...findSurahByAyaid(nextPage - 1)]
first: findSurahByAyahId(curPage),
last: [...findSurahByAyahId(nextPage - 1)]
};

@@ -1303,3 +1303,3 @@ }

function isAyahJuzFirst(surah, ayah, ayahMode = false) {
const ayahId = ayahMode ? checkValidAyahId(ayah) && ayah : checkValidSurah(surah) && findAyaidBySurah(surah, ayah);
const ayahId = ayahMode ? checkValidAyahId(ayah) && ayah : checkValidSurah(surah) && findAyahIdBySurah(surah, ayah);
return binarySearch(JuzList, ayahId);

@@ -1309,3 +1309,3 @@ }

function isAyahPageFirst(surah, ayah, ayahMode = false) {
const ayahId = ayahMode ? checkValidAyahId(ayah) && ayah : checkValidSurah(surah) && findAyaidBySurah(surah, ayah);
const ayahId = ayahMode ? checkValidAyahId(ayah) && ayah : checkValidSurah(surah) && findAyahIdBySurah(surah, ayah);
return binarySearch(PageList, ayahId);

@@ -1890,4 +1890,4 @@ }

throw new RangeError("Surah must be between 1 and " + meta.numSuras);
const ayaid = findAyaidBySurah(surah, ayah);
return findSurahByAyaid(ayaid == meta.numAyahs ? 1 : ayaid + 1);
const ayahId = findAyahIdBySurah(surah, ayah);
return findSurahByAyahId(ayahId == meta.numAyahs ? 1 : ayahId + 1);
}

@@ -1897,4 +1897,4 @@

checkValidSurah(surah);
const ayaid = findAyaidBySurah(surah, ayah);
return findSurahByAyaid(ayaid == 1 ? meta.numAyahs : ayaid - 1);
const ayahId = findAyahIdBySurah(surah, ayah);
return findSurahByAyahId(ayahId == 1 ? meta.numAyahs : ayahId - 1);
}

@@ -2145,10 +2145,10 @@

exports.SurahList = SurahList;
exports.ayaStringSplitter = ayaStringSplitter;
exports.ayahStringSplitter = ayahStringSplitter;
exports.checkValidAyahId = checkValidAyahId;
exports.checkValidSurah = checkValidSurah;
exports.checkValidSurahAyah = checkValidSurahAyah;
exports.findAyaidBySurah = findAyaidBySurah;
exports.findAyahIdBySurah = findAyahIdBySurah;
exports.findJuz = findJuz;
exports.findJuzAndShift = findJuzAndShift;
exports.findJuzByAyaid = findJuzByAyaid;
exports.findJuzByAyahId = findJuzByAyahId;
exports.findJuzMetaBySurah = findJuzMetaBySurah;

@@ -2158,9 +2158,9 @@ exports.findPage = findPage;

exports.findRubAlHizb = findRubAlHizb;
exports.findRubAlHizbByAyaid = findRubAlHizbByAyaid;
exports.findSurahByAyaid = findSurahByAyaid;
exports.getAyahCountinSurah = getAyahCountinSurah;
exports.findRubAlHizbByAyahId = findRubAlHizbByAyahId;
exports.findSurahByAyahId = findSurahByAyahId;
exports.getAyahCountInSurah = getAyahCountInSurah;
exports.getAyahMeta = getAyahMeta;
exports.getPageMeta = getPageMeta;
exports.getRubAlHizbMeta = getRubAlHizbMeta;
exports.getRubAlHizbMetaByAyaid = getRubAlHizbMetaByAyaid;
exports.getRubAlHizbMetaByAyahId = getRubAlHizbMetaByAyahId;
exports.getSurahMeta = getSurahMeta;

@@ -2167,0 +2167,0 @@ exports.isAyahJuzFirst = isAyahJuzFirst;

/*!
* Quran Meta library 3.0.1-7
* Quran Meta library 3.0.1-8
*

@@ -137,3 +137,3 @@ * Released under the MIT license

return SurahList[surah];
}function getAyahCountinSurah(surah) {
}function getAyahCountInSurah(surah) {
return getSurahMeta(surah)[1];

@@ -153,5 +153,5 @@ }function checkValidSurah(surah, checkOnly = false) {

if (!checkValidSurah(surah, checkOnly)) return false;
if (ayah < 1 || ayah > getAyahCountinSurah(surah)) {
if (ayah < 1 || ayah > getAyahCountInSurah(surah)) {
if (checkOnly) return false;
throw new RangeError("Ayah must be between 1 and " + getAyahCountinSurah(surah));
throw new RangeError("Ayah must be between 1 and " + getAyahCountInSurah(surah));
}

@@ -170,3 +170,3 @@ return true;

return true;
}function ayaStringSplitter(str) {
}function ayahStringSplitter(str) {
const [surahStr, ayahsStr] = str.trim().split(":");

@@ -198,3 +198,3 @@ const surah = parseInt(surahStr, 10);

return [surah, ayahs];
}function findAyaidBySurah(surah, ayah) {
}function findAyahIdBySurah(surah, ayah) {
checkValidSurahAyah(surah, ayah);

@@ -236,9 +236,9 @@ const [startAyahId] = getSurahMeta(surah);

6237
];function findJuzByAyaid(ayaId) {
checkValidAyahId(ayaId);
return JuzList.findIndex((x) => x > ayaId) - 1;
];function findJuzByAyahId(ayahId) {
checkValidAyahId(ayahId);
return JuzList.findIndex((x) => x > ayahId) - 1;
}function findJuz(surah, ayah = 1, ayahMode = false) {
const ayahId = ayahMode ? ayah : checkValidSurahAyah(surah, ayah) && findAyaidBySurah(surah, ayah);
return findJuzByAyaid(ayahId);
}function findSurahByAyaid(ayaId) {
const ayahId = ayahMode ? ayah : checkValidSurahAyah(surah, ayah) && findAyahIdBySurah(surah, ayah);
return findJuzByAyahId(ayahId);
}function findSurahByAyahId(ayaId) {
checkValidAyahId(ayaId);

@@ -248,6 +248,6 @@ const suraNum = SurahList.findIndex((x) => x[0] > ayaId) - 1;

}function findJuzAndShift(surah, ayah, ayahMode = false) {
const ayahId = ayahMode ? checkValidAyahId(ayah) && ayah : checkValidSurah(surah) && findAyaidBySurah(surah, ayah);
const juz = findJuzByAyaid(ayahId);
const ayahId = ayahMode ? checkValidAyahId(ayah) && ayah : checkValidSurah(surah) && findAyahIdBySurah(surah, ayah);
const juz = findJuzByAyahId(ayahId);
const leftAyahId = JuzList[juz];
if (ayahMode) [surah] = findSurahByAyaid(ayahId);
if (ayahMode) [surah] = findSurahByAyahId(ayahId);
const [surahStartAyahId] = SurahList[surah];

@@ -266,3 +266,3 @@ return {

let rightJuz = leftjuz;
while (rightJuz < meta.numJuzs && findSurahByAyaid(JuzList[rightJuz + 1])[0] === surah) {
while (rightJuz < meta.numJuzs && findSurahByAyahId(JuzList[rightJuz + 1])[0] === surah) {
rightJuz++;

@@ -885,9 +885,9 @@ }

];function findPage(surah, ayah, ayahMode = false) {
const ayahId = ayahMode ? checkValidAyahId(ayah) && ayah : checkValidSurah(surah) && findAyaidBySurah(surah, ayah);
const ayahId = ayahMode ? checkValidAyahId(ayah) && ayah : checkValidSurah(surah) && findAyahIdBySurah(surah, ayah);
return PageList.findIndex((x) => x > ayahId) - 1;
}function findRangeAroundAyah(surah, ayah, mode, ayahMode = false) {
const ayahId = ayahMode ? ayah : checkValidSurah(surah) && findAyaidBySurah(surah, ayah);
const ayahId = ayahMode ? ayah : checkValidSurah(surah) && findAyahIdBySurah(surah, ayah);
switch (mode) {
case "juz": {
const juz = findJuzByAyaid(ayahId);
const juz = findJuzByAyahId(ayahId);
return [JuzList[juz], JuzList[juz + 1] - 1];

@@ -1152,5 +1152,5 @@ }

6237
];function findRubAlHizbByAyaid(ayaId) {
checkValidAyahId(ayaId);
return HizbQuarterList.findIndex((x) => x > ayaId) - 1;
];function findRubAlHizbByAyahId(ayahId) {
checkValidAyahId(ayahId);
return HizbQuarterList.findIndex((x) => x > ayahId) - 1;
}function getRubAlHizbMeta(quarterIndex) {

@@ -1161,11 +1161,11 @@ const juz = Math.floor((quarterIndex - 1) / 8) + 1;

return { juz, hizbId: hizbIndex, juzPart, rubAlHizbId: quarterIndex };
}function getRubAlHizbMetaByAyaid(ayaId) {
checkValidAyahId(ayaId);
const quarterIndex = findRubAlHizbByAyaid(ayaId);
}function getRubAlHizbMetaByAyahId(ayahId) {
checkValidAyahId(ayahId);
const quarterIndex = findRubAlHizbByAyahId(ayahId);
return getRubAlHizbMeta(quarterIndex);
}function findRubAlHizb(surah, ayah = 1, ayahMode = false) {
const ayahId = ayahMode ? ayah : checkValidSurah(surah) && findAyaidBySurah(surah, ayah);
return getRubAlHizbMetaByAyaid(ayahId);
const ayahId = ayahMode ? ayah : checkValidSurah(surah) && findAyahIdBySurah(surah, ayah);
return getRubAlHizbMetaByAyahId(ayahId);
}const SajdaList = [
// [ayaId, type]
// [ayahId, type]
[1160, "recommended"],

@@ -1189,4 +1189,4 @@ [1722, "recommended"],

throw new RangeError("ayahId must be between 1 and " + meta.numAyahs);
const quarterData = getRubAlHizbMetaByAyaid(ayahId);
const [surah, ayah] = findSurahByAyaid(ayahId);
const quarterData = getRubAlHizbMetaByAyahId(ayahId);
const [surah, ayah] = findSurahByAyahId(ayahId);
const page = findPage(-1, ayahId, true);

@@ -1225,4 +1225,4 @@ const isSajdahAyah = SajdaList.some(([sajdaAyahId]) => sajdaAyahId === ayahId);

pageNum,
first: findSurahByAyaid(curPage),
last: [...findSurahByAyaid(nextPage - 1)]
first: findSurahByAyahId(curPage),
last: [...findSurahByAyahId(nextPage - 1)]
};

@@ -1245,6 +1245,6 @@ }function binarySearch(ar, el, compare_fn = (a, b) => a - b) {

}function isAyahJuzFirst(surah, ayah, ayahMode = false) {
const ayahId = ayahMode ? checkValidAyahId(ayah) && ayah : checkValidSurah(surah) && findAyaidBySurah(surah, ayah);
const ayahId = ayahMode ? checkValidAyahId(ayah) && ayah : checkValidSurah(surah) && findAyahIdBySurah(surah, ayah);
return binarySearch(JuzList, ayahId);
}function isAyahPageFirst(surah, ayah, ayahMode = false) {
const ayahId = ayahMode ? checkValidAyahId(ayah) && ayah : checkValidSurah(surah) && findAyaidBySurah(surah, ayah);
const ayahId = ayahMode ? checkValidAyahId(ayah) && ayah : checkValidSurah(surah) && findAyahIdBySurah(surah, ayah);
return binarySearch(PageList, ayahId);

@@ -1823,8 +1823,8 @@ }const ManzilList = [

throw new RangeError("Surah must be between 1 and " + meta.numSuras);
const ayaid = findAyaidBySurah(surah, ayah);
return findSurahByAyaid(ayaid == meta.numAyahs ? 1 : ayaid + 1);
const ayahId = findAyahIdBySurah(surah, ayah);
return findSurahByAyahId(ayahId == meta.numAyahs ? 1 : ayahId + 1);
}function prevAyah(surah, ayah) {
checkValidSurah(surah);
const ayaid = findAyaidBySurah(surah, ayah);
return findSurahByAyaid(ayaid == 1 ? meta.numAyahs : ayaid - 1);
const ayahId = findAyahIdBySurah(surah, ayah);
return findSurahByAyahId(ayahId == 1 ? meta.numAyahs : ayahId - 1);
}const surahNames$1 = [

@@ -2062,2 +2062,2 @@ [],

["\u0410\u043D-\u041D\u0430\u0441", "\u041B\u044E\u0434\u0438"]
];exports.HizbQuarterList=HizbQuarterList;exports.JuzList=JuzList;exports.ManzilList=ManzilList;exports.PageList=PageList;exports.RukuList=RukuList;exports.SajdaList=SajdaList;exports.SurahList=SurahList;exports.ayaStringSplitter=ayaStringSplitter;exports.checkValidAyahId=checkValidAyahId;exports.checkValidSurah=checkValidSurah;exports.checkValidSurahAyah=checkValidSurahAyah;exports.findAyaidBySurah=findAyaidBySurah;exports.findJuz=findJuz;exports.findJuzAndShift=findJuzAndShift;exports.findJuzByAyaid=findJuzByAyaid;exports.findJuzMetaBySurah=findJuzMetaBySurah;exports.findPage=findPage;exports.findRangeAroundAyah=findRangeAroundAyah;exports.findRubAlHizb=findRubAlHizb;exports.findRubAlHizbByAyaid=findRubAlHizbByAyaid;exports.findSurahByAyaid=findSurahByAyaid;exports.getAyahCountinSurah=getAyahCountinSurah;exports.getAyahMeta=getAyahMeta;exports.getPageMeta=getPageMeta;exports.getRubAlHizbMeta=getRubAlHizbMeta;exports.getRubAlHizbMetaByAyaid=getRubAlHizbMetaByAyaid;exports.getSurahMeta=getSurahMeta;exports.isAyahJuzFirst=isAyahJuzFirst;exports.isAyahPageFirst=isAyahPageFirst;exports.meta=meta;exports.nextAyah=nextAyah;exports.prevAyah=prevAyah;exports.surahNamesEn=surahNames$1;exports.surahNamesRu=surahNames;}));
];exports.HizbQuarterList=HizbQuarterList;exports.JuzList=JuzList;exports.ManzilList=ManzilList;exports.PageList=PageList;exports.RukuList=RukuList;exports.SajdaList=SajdaList;exports.SurahList=SurahList;exports.ayahStringSplitter=ayahStringSplitter;exports.checkValidAyahId=checkValidAyahId;exports.checkValidSurah=checkValidSurah;exports.checkValidSurahAyah=checkValidSurahAyah;exports.findAyahIdBySurah=findAyahIdBySurah;exports.findJuz=findJuz;exports.findJuzAndShift=findJuzAndShift;exports.findJuzByAyahId=findJuzByAyahId;exports.findJuzMetaBySurah=findJuzMetaBySurah;exports.findPage=findPage;exports.findRangeAroundAyah=findRangeAroundAyah;exports.findRubAlHizb=findRubAlHizb;exports.findRubAlHizbByAyahId=findRubAlHizbByAyahId;exports.findSurahByAyahId=findSurahByAyahId;exports.getAyahCountInSurah=getAyahCountInSurah;exports.getAyahMeta=getAyahMeta;exports.getPageMeta=getPageMeta;exports.getRubAlHizbMeta=getRubAlHizbMeta;exports.getRubAlHizbMetaByAyahId=getRubAlHizbMetaByAyahId;exports.getSurahMeta=getSurahMeta;exports.isAyahJuzFirst=isAyahJuzFirst;exports.isAyahPageFirst=isAyahPageFirst;exports.meta=meta;exports.nextAyah=nextAyah;exports.prevAyah=prevAyah;exports.surahNamesEn=surahNames$1;exports.surahNamesRu=surahNames;}));
export type { QuranMeta } from "./const";
export type { AyahId, AyahMeta, AyahNo, Juz, JuzHizb, JuzMeta, Page, PageMeta, Sajda, SajdaType, Surah, SurahAyah, SurahAyahSegment, SurahMeta, SurahName } from "./types";
export { ayaStringSplitter } from "./ayaStringSplitter";
export { ayahStringSplitter } from "./ayahStringSplitter";
export { meta } from "./const";
export { findAyaidBySurah } from "./findAyaidBySurah";
export { findAyahIdBySurah } from "./findAyahIdBySurah";
export { findJuz } from "./findJuz";
export { findJuzAndShift } from "./findJuzAndShift";
export { findJuzByAyaid } from "./findJuzByAyaid";
export { findJuzMetaBySurah as findJuzMetaBySurah } from "./findJuzMetaBySurah";
export { findJuzByAyahId } from "./findJuzByAyahId";
export { findJuzMetaBySurah } from "./findJuzMetaBySurah";
export { findPage } from "./findPage";
export { findRangeAroundAyah } from "./findRangeAroundAyah";
export { findRubAlHizb } from "./findRubAlHizb";
export { findRubAlHizbByAyaid } from "./findRubAlHizbByAyaid";
export { findSurahByAyaid } from "./findSurahByAyaid";
export { getAyahCountinSurah as getAyahCountinSurah } from "./getAyahCountinSurah";
export { findRubAlHizbByAyahId } from "./findRubAlHizbByAyahId";
export { findSurahByAyahId } from "./findSurahByAyahId";
export { getAyahCountInSurah } from "./getAyahCountInSurah";
export { getAyahMeta } from "./getAyahMeta";
export { getPageMeta } from "./getPageMeta";
export { getRubAlHizbMeta } from "./getRubAlHizbMeta";
export { getRubAlHizbMetaByAyaid } from "./getRubAlHizbMetaByAyaid";
export { getRubAlHizbMetaByAyahId } from "./getRubAlHizbMetaByAyahId";
export { getSurahMeta } from "./getSurahMeta";

@@ -33,3 +33,3 @@ export { isAyahJuzFirst } from "./isAyahJuzFirst";

export { checkValidAyahId, checkValidSurah, checkValidSurahAyah } from "./validation";
export { surahNames as surahNamesEn } from "./i18n/sura.en";
export { surahNames as surahNamesRu } from "./i18n/sura.ru";
export { surahNames as surahNamesEn } from "./i18n/surah.en";
export { surahNames as surahNamesRu } from "./i18n/surah.ru";

@@ -9,4 +9,4 @@ import { AyahNo, Juz, Surah } from "./types";

* @param ayahMode - If true, the `ayah` parameter is treated as an Ayah ID instead of a Surah and Ayah number.
* @returns The Juz (part) number that the given Ayah belongs to. Returns Positive number if aya is first ayah of juz, number is juz number
* @returns The Juz (part) number that the given Ayah belongs to. Returns Positive number if ayah is first ayah of juz, number is juz number
*/
export declare function isAyahJuzFirst(surah: Surah, ayah: AyahNo, ayahMode?: boolean): Juz;

@@ -11,3 +11,3 @@ {

],
"version": "3.0.1-7",
"version": "3.0.1-8",
"license": "MIT",

@@ -14,0 +14,0 @@ "jsdelivr": "./dist/index.mjs",

@@ -34,4 +34,4 @@ Quran Meta

* How many ayahs in given sura (`getAyahCountinSurah`)
* Is given aya
* How many ayahs in given surah (`getAyahCountinSurah`)
* Is given ayah
* a sajdah ayah (`getAyahMeta`)?

@@ -42,6 +42,6 @@ * beginnning of a page (`isAyahPageFirst`)?

* next or previous ayah (`nextAyah`/`prevAyah`)
* juz `findJuz` and `findJuzByAyaid`
* hizb `findRubAlHizb`, `getRubAlHizbMetaByAyaid`
* page `findPage` by surah/aya
* Ayaid of a given surah/aya (`findAyaidBySurah`)
* juz `findJuz` and `findJuzByAyahId`
* hizb `findRubAlHizb`, `getRubAlHizbMetaByAyahId`
* page `findPage` by surah/ayah
* AyahId of a given surah/ayah (`findAyahIdBySurah`)
* find range around ayah (`findRangeAroundAyah`)

@@ -53,6 +53,6 @@ * Get meta data for

* juz (`findJuzMetaBySurah`)
* maqra/rub-el-hizb (`getRubAlHizbMeta`, `getRubAlHizbMetaByAyaid`)
* maqra/rub-el-hizb (`getRubAlHizbMeta`, `getRubAlHizbMetaByAyahId`)
* Validates ayah/surah id (`checkValidAyahId`,`checkValidSurah`, `checkValidSurahAyah`)
* converts `[surah,aya]` to `ayaId` and vice-verse ( `findSurahByAyaid` and `findAyaidBySurah`)
* Checks and turns strings of type "x:y" or "x:y1-y2" to surah/aya range `ayaStringSplitter`.
* converts `[surah, ayah]` to `ayahId` and vice-verse ( `findSurahByAyahId` and `findAyahIdBySurah`)
* Checks and turns strings of type "x:y" or "x:y1-y2" to surah/ayah range `ayaStringSplitter`.

@@ -117,4 +117,4 @@ ### Installation

* Surah: A chapter of the Quran. There are 114 chapters in Quran, each of different length.
* Aya: A verse number in the particular surah (chapter) of Quran. it is relative to the surah.
* Ayaid: Unique identifier for a verse in the Quran. It is a number that is the concatenation of the of sum ayahs of previous chapters of Quran and the verse number of particular Aya. There are 6236 ayahs in Quran. AyaId is absolute and is not relative to any surah.
* Ayah: A verse number in the particular surah (chapter) of Quran. it is relative to the surah.
* AyahId: Unique identifier for a verse in the Quran. It is a number that is the concatenation of the of sum ayahs of previous chapters of Quran and the verse number of particular Ayah. There are 6236 ayahs in Quran. AyahId is absolute, positive and is not relative to any surah.

@@ -121,0 +121,0 @@ * *Juz*: A section of the Quran. There are 30 Juz in Quran of roughly equal length.

@@ -1,3 +0,3 @@

import { findAyaidBySurah } from "./findAyaidBySurah"
import { findJuzByAyaid } from "./findJuzByAyaid"
import { findAyahIdBySurah } from "./findAyahIdBySurah"
import { findJuzByAyahId } from "./findJuzByAyahId"
import { AyahId, AyahNo, Juz, Surah } from "./types"

@@ -18,5 +18,5 @@ import { checkValidSurahAyah } from "./validation"

: ((checkValidSurahAyah(surah, ayah)
&& findAyaidBySurah(surah, ayah)) as AyahId)
&& findAyahIdBySurah(surah, ayah)) as AyahId)
return findJuzByAyaid(ayahId)
return findJuzByAyahId(ayahId)
}

@@ -1,4 +0,4 @@

import { findAyaidBySurah } from "./findAyaidBySurah"
import { findJuzByAyaid } from "./findJuzByAyaid"
import { findSurahByAyaid } from "./findSurahByAyaid"
import { findAyahIdBySurah } from "./findAyahIdBySurah"
import { findJuzByAyahId } from "./findJuzByAyahId"
import { findSurahByAyahId } from "./findSurahByAyahId"
import { JuzList } from "./lists/juzList"

@@ -31,7 +31,7 @@ import { SurahList } from "./lists/surahList"

? ((checkValidAyahId(ayah) && ayah) as AyahId)
: ((checkValidSurah(surah) && findAyaidBySurah(surah, ayah)) as AyahId)
: ((checkValidSurah(surah) && findAyahIdBySurah(surah, ayah)) as AyahId)
const juz = findJuzByAyaid(ayahId)
const juz = findJuzByAyahId(ayahId)
const leftAyahId = JuzList[juz]
if (ayahMode) [surah] = findSurahByAyaid(ayahId)
if (ayahMode) [surah] = findSurahByAyahId(ayahId)
const [surahStartAyahId] = SurahList[surah]

@@ -38,0 +38,0 @@ return {

import { meta } from "./const"
import { findJuzAndShift } from "./findJuzAndShift"
import { findSurahByAyaid } from "./findSurahByAyaid"
import { findSurahByAyahId } from "./findSurahByAyahId"
import { JuzList } from "./lists/juzList"

@@ -24,3 +24,3 @@ import { AyahNo, Juz, JuzMeta, Surah } from "./types"

rightJuz < meta.numJuzs
&& findSurahByAyaid(JuzList[rightJuz + 1])[0] === surah
&& findSurahByAyahId(JuzList[rightJuz + 1])[0] === surah
) {

@@ -27,0 +27,0 @@ rightJuz++

@@ -1,2 +0,2 @@

import { findAyaidBySurah } from "./findAyaidBySurah"
import { findAyahIdBySurah } from "./findAyahIdBySurah"
import { PageList } from "./lists/pageList"

@@ -17,5 +17,5 @@ import { AyahId, AyahNo, Page, Surah } from "./types"

? ((checkValidAyahId(ayah) && ayah) as AyahId)
: ((checkValidSurah(surah) && findAyaidBySurah(surah, ayah)) as AyahId)
: ((checkValidSurah(surah) && findAyahIdBySurah(surah, ayah)) as AyahId)
return PageList.findIndex(x => x > ayahId) - 1
}
import { meta } from "./const"
import { findAyaidBySurah } from "./findAyaidBySurah"
import { findJuzByAyaid } from "./findJuzByAyaid"
import { findAyahIdBySurah } from "./findAyahIdBySurah"
import { findJuzByAyahId } from "./findJuzByAyahId"
import { findPage } from "./findPage"

@@ -28,7 +28,7 @@ import { JuzList } from "./lists/juzList"

? ayah
: ((checkValidSurah(surah) && findAyaidBySurah(surah, ayah)) as AyahId)
: ((checkValidSurah(surah) && findAyahIdBySurah(surah, ayah)) as AyahId)
switch (mode) {
case "juz": {
const juz: Juz = findJuzByAyaid(ayahId)
const juz: Juz = findJuzByAyahId(ayahId)
return [JuzList[juz], JuzList[juz + 1] - 1]

@@ -35,0 +35,0 @@ }

@@ -1,3 +0,3 @@

import { findAyaidBySurah } from "./findAyaidBySurah"
import { getRubAlHizbMetaByAyaid } from "./getRubAlHizbMetaByAyaid"
import { findAyahIdBySurah } from "./findAyahIdBySurah"
import { getRubAlHizbMetaByAyahId } from "./getRubAlHizbMetaByAyahId"
import { AyahId, AyahNo, JuzHizb, Surah } from "./types"

@@ -21,5 +21,5 @@ import { checkValidSurah } from "./validation"

? ayah
: ((checkValidSurah(surah) && findAyaidBySurah(surah, ayah)) as AyahId)
: ((checkValidSurah(surah) && findAyahIdBySurah(surah, ayah)) as AyahId)
return getRubAlHizbMetaByAyaid(ayahId)
return getRubAlHizbMetaByAyahId(ayahId)
}
import { meta } from "./const"
import { findPage } from "./findPage"
import { findSurahByAyaid } from "./findSurahByAyaid"
import { getRubAlHizbMetaByAyaid } from "./getRubAlHizbMetaByAyaid"
import { findSurahByAyahId } from "./findSurahByAyahId"
import { getRubAlHizbMetaByAyahId } from "./getRubAlHizbMetaByAyahId"
import { HizbQuarterList } from "./lists/hizbList"

@@ -23,4 +23,4 @@ import { JuzList } from "./lists/juzList"

const quarterData = getRubAlHizbMetaByAyaid(ayahId)
const [surah, ayah] = findSurahByAyaid(ayahId)
const quarterData = getRubAlHizbMetaByAyahId(ayahId)
const [surah, ayah] = findSurahByAyahId(ayahId)
const page: Page = findPage(-1, ayahId, true)

@@ -27,0 +27,0 @@ const isSajdahAyah = SajdaList.some(([sajdaAyahId]) => sajdaAyahId === ayahId)

import { meta } from "./const"
import { findSurahByAyaid } from "./findSurahByAyaid"
import { findSurahByAyahId } from "./findSurahByAyahId"
import { PageList } from "./lists/pageList"

@@ -24,5 +24,5 @@ import { AyahId, Page, PageMeta } from "./types"

pageNum,
first: findSurahByAyaid(curPage),
last: [...findSurahByAyaid(nextPage - 1)]
first: findSurahByAyahId(curPage),
last: [...findSurahByAyahId(nextPage - 1)]
}
}

@@ -12,5 +12,5 @@ import { JuzHizb } from "./types"

// const quarterIndex = HizbQuarterList.findIndex(x => x > ayaId) - 1
// const quarterIndex = HizbQuarterList.findIndex(x => x > ayahId) - 1
// const juz = findJuzByAyaid(ayaId)
// const juz = findJuzByAyahId(ayahId)
const juz = Math.floor((quarterIndex - 1) / 8) + 1

@@ -17,0 +17,0 @@

@@ -8,19 +8,19 @@ // Quran Meta

export { ayaStringSplitter } from "./ayaStringSplitter"
export { ayahStringSplitter } from "./ayahStringSplitter"
export { meta } from "./const"
export { findAyaidBySurah } from "./findAyaidBySurah"
export { findAyahIdBySurah } from "./findAyahIdBySurah"
export { findJuz } from "./findJuz"
export { findJuzAndShift } from "./findJuzAndShift"
export { findJuzByAyaid } from "./findJuzByAyaid"
export { findJuzMetaBySurah as findJuzMetaBySurah } from "./findJuzMetaBySurah"
export { findJuzByAyahId } from "./findJuzByAyahId"
export { findJuzMetaBySurah } from "./findJuzMetaBySurah"
export { findPage } from "./findPage"
export { findRangeAroundAyah } from "./findRangeAroundAyah"
export { findRubAlHizb } from "./findRubAlHizb"
export { findRubAlHizbByAyaid } from "./findRubAlHizbByAyaid"
export { findSurahByAyaid } from "./findSurahByAyaid"
export { getAyahCountinSurah as getAyahCountinSurah } from "./getAyahCountinSurah"
export { findRubAlHizbByAyahId } from "./findRubAlHizbByAyahId"
export { findSurahByAyahId } from "./findSurahByAyahId"
export { getAyahCountInSurah } from "./getAyahCountInSurah"
export { getAyahMeta } from "./getAyahMeta"
export { getPageMeta } from "./getPageMeta"
export { getRubAlHizbMeta } from "./getRubAlHizbMeta"
export { getRubAlHizbMetaByAyaid } from "./getRubAlHizbMetaByAyaid"
export { getRubAlHizbMetaByAyahId } from "./getRubAlHizbMetaByAyahId"
export { getSurahMeta } from "./getSurahMeta"

@@ -42,3 +42,3 @@ export { isAyahJuzFirst } from "./isAyahJuzFirst"

export { surahNames as surahNamesEn } from "./i18n/sura.en"
export { surahNames as surahNamesRu } from "./i18n/sura.ru"
export { surahNames as surahNamesEn } from "./i18n/surah.en"
export { surahNames as surahNamesRu } from "./i18n/surah.ru"

@@ -1,2 +0,2 @@

import { findAyaidBySurah } from "./findAyaidBySurah"
import { findAyahIdBySurah } from "./findAyahIdBySurah"
import { JuzList } from "./lists/juzList"

@@ -14,3 +14,3 @@ import { AyahId, AyahNo, Juz, Surah } from "./types"

* @param ayahMode - If true, the `ayah` parameter is treated as an Ayah ID instead of a Surah and Ayah number.
* @returns The Juz (part) number that the given Ayah belongs to. Returns Positive number if aya is first ayah of juz, number is juz number
* @returns The Juz (part) number that the given Ayah belongs to. Returns Positive number if ayah is first ayah of juz, number is juz number
*/

@@ -24,3 +24,3 @@ export function isAyahJuzFirst(

? ((checkValidAyahId(ayah) && ayah) as AyahId)
: ((checkValidSurah(surah) && findAyaidBySurah(surah, ayah)) as AyahId)
: ((checkValidSurah(surah) && findAyahIdBySurah(surah, ayah)) as AyahId)

@@ -27,0 +27,0 @@ return binarySearch(JuzList, ayahId)

@@ -1,2 +0,2 @@

import { findAyaidBySurah } from "./findAyaidBySurah"
import { findAyahIdBySurah } from "./findAyahIdBySurah"
import { PageList } from "./lists/pageList"

@@ -22,3 +22,3 @@ import { AyahId, AyahNo, Page, Surah } from "./types"

? ((checkValidAyahId(ayah) && ayah) as AyahId)
: ((checkValidSurah(surah) && findAyaidBySurah(surah, ayah)) as AyahId)
: ((checkValidSurah(surah) && findAyahIdBySurah(surah, ayah)) as AyahId)

@@ -25,0 +25,0 @@ return binarySearch(PageList, ayahId)

@@ -14,3 +14,3 @@ import { Sajda } from "../types"

export const SajdaList: Sajda[] = [
// [ayaId, type]
// [ayahId, type]
[1160, "recommended"],

@@ -17,0 +17,0 @@ [1722, "recommended"],

import { meta } from "./const"
import { findAyaidBySurah } from "./findAyaidBySurah"
import { findSurahByAyaid } from "./findSurahByAyaid"
import { findAyahIdBySurah } from "./findAyahIdBySurah"
import { findSurahByAyahId } from "./findSurahByAyahId"
import { AyahId, AyahNo, Surah, SurahAyah } from "./types"

@@ -16,4 +16,4 @@

const ayaid: AyahId = findAyaidBySurah(surah, ayah)
return findSurahByAyaid(ayaid == meta.numAyahs ? 1 : ayaid + 1)
const ayahId: AyahId = findAyahIdBySurah(surah, ayah)
return findSurahByAyahId(ayahId == meta.numAyahs ? 1 : ayahId + 1)
}
import { meta } from "./const"
import { findAyaidBySurah } from "./findAyaidBySurah"
import { findSurahByAyaid } from "./findSurahByAyaid"
import { findAyahIdBySurah } from "./findAyahIdBySurah"
import { findSurahByAyahId } from "./findSurahByAyahId"
import { AyahId, AyahNo, Surah, SurahAyah } from "./types"

@@ -16,4 +16,4 @@ import { checkValidSurah } from "./validation"

const ayaid: AyahId = findAyaidBySurah(surah, ayah)
return findSurahByAyaid(ayaid == 1 ? meta.numAyahs : ayaid - 1)
const ayahId: AyahId = findAyahIdBySurah(surah, ayah)
return findSurahByAyahId(ayahId == 1 ? meta.numAyahs : ayahId - 1)
}
import { meta } from "./const"
import { getAyahCountinSurah } from "./getAyahCountinSurah"
import { getAyahCountInSurah } from "./getAyahCountInSurah"

@@ -35,5 +35,5 @@ /**

if (ayah < 1 || ayah > getAyahCountinSurah(surah)) {
if (ayah < 1 || ayah > getAyahCountInSurah(surah)) {
if (checkOnly) return false
throw new RangeError("Ayah must be between 1 and " + getAyahCountinSurah(surah))
throw new RangeError("Ayah must be between 1 and " + getAyahCountInSurah(surah))
}

@@ -40,0 +40,0 @@ return true

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc