UNPKG

quran-meta

Version:

Library with meta data and functionality related to Holy Quran

18 lines (17 loc) 684 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getPageMeta = getPageMeta; var _const = require("./const.cjs"); var _findSurahByAyahId = require("./findSurahByAyahId.cjs"); var _pageList = require("./lists/pageList.cjs"); function getPageMeta(pageNum) { if (pageNum < 1 || pageNum > _const.meta.numPages) throw new RangeError("pagenum must be between 1 and " + _const.meta.numPages); const [curPage, nextPage] = [_pageList.PageList[pageNum], _pageList.PageList[pageNum + 1]]; return { pageNum, first: (0, _findSurahByAyahId.findSurahByAyahId)(curPage), last: [...(0, _findSurahByAyahId.findSurahByAyahId)(nextPage - 1)] }; }