npm install page-arr@latest
const pagearr = require("page-arr")(9);
let currentPage = 6;
let sumPageNum = 100;
let result = pagearr(currentPage,sumPageNum);
// result:
//
// { pageArr: [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ],
// lastPage: 100,
// currentPage: 6 }
result = pagearr(45,100);
// result:
//
// { pageArr: [ 41, 42, 43, 44, 45, 46, 47, 48, 49 ],
// lastPage: 100,
// currentPage: 45,
// prevGroupStartPage: 33 }
MIT