function getEntireChapter(chapter, arabic) { if (isNaN(chapter)) { print(colors.red('Invalid chapter number.')); process.exit(1); } let table = new Table({ colWidths: [null, 80], wordWrap: true, style: { head: [], border: [] } }); table.push( [{ colSpan: 2, content: colors.green(meta.sura[chapter].$.index + ' : ' + meta.sura[chapter].$.name + ' (' + meta.sura[chapter].$.ename + ')') }] ); table.push( [colors.cyan('Verse'), colors.cyan('Text')] ); table = setVerses(table, chapter, quran[chapter].aya, arabic); print(table.toString()); }
function listChapters() { let table = new Table({ head: [colors.cyan('Index'), colors.cyan('Chapter')] }); for (let i = 0; i <= 113; i++) { chapterList.push({ index: (i + 1), name: meta.sura[i].$.tname, ename: meta.sura[i].$.ename, aname: meta.sura[i].$.name, ayas: meta.sura[i].$.ayas, rukus: meta.sura[i].$.rukus, start: meta.sura[i].$.start, type: meta.sura[i].$.type, order: meta.sura[i].$.order }); } chapterList.forEach(function (chapter) { table.push([colors.green(chapter.index), colors.yellow(chapter.name)]); }); print(table.toString()); }