UNPKG

quran-meta

Version:

Library with meta data and functionality related to Holy Quran

32 lines (30 loc) 1.03 kB
const require_HafsLists = require('./HafsLists.cjs'); const require_QalunLists = require('./QalunLists.cjs'); const require_WarshLists = require('./WarshLists.cjs'); //#region src/lists/index.ts /** * Retrieves the lists associated with a specific Riwaya. * Uses switch statement to enable tree-shaking. * * @example * ```typescript * const hafsLists = getListsOfRiwaya('Hafs'); * ``` */ function getListsOfRiwaya(riwaya) { switch (riwaya) { case "Hafs": return require_HafsLists.HafsLists; case "Qalun": return require_QalunLists.QalunLists; case "Warsh": return require_WarshLists.WarshLists; default: throw new Error(`Unknown riwaya: ${riwaya}`); } } const getListOfRiwaya = (listName, riwaya) => { const actualRiwaya = riwaya || "Hafs"; const lists = getListsOfRiwaya(actualRiwaya); if (listName in lists) return lists[listName]; throw new Error(`List ${String(listName)} not found in ${actualRiwaya} riwaya`); }; //#endregion exports.getListOfRiwaya = getListOfRiwaya; exports.getListsOfRiwaya = getListsOfRiwaya;