{"id":19042002,"url":"https://github.com/writetome51/big-dataset-paginator","last_synced_at":"2026-05-17T19:03:37.853Z","repository":{"id":122062375,"uuid":"186331940","full_name":"writetome51/big-dataset-paginator","owner":"writetome51","description":"A TypeScript/JavaScript class for pagination in a real-world web app.","archived":false,"fork":false,"pushed_at":"2021-03-10T20:27:21.000Z","size":112,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-19T14:54:10.725Z","etag":null,"topics":["app","data","javascript","pagination","paginator","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/writetome51.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-13T02:29:37.000Z","updated_at":"2021-03-11T23:07:03.000Z","dependencies_parsed_at":"2023-07-22T18:16:08.264Z","dependency_job_id":null,"html_url":"https://github.com/writetome51/big-dataset-paginator","commit_stats":null,"previous_names":["writetome51/app-paginator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/writetome51/big-dataset-paginator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Fbig-dataset-paginator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Fbig-dataset-paginator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Fbig-dataset-paginator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Fbig-dataset-paginator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/writetome51","download_url":"https://codeload.github.com/writetome51/big-dataset-paginator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Fbig-dataset-paginator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33151625,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T09:28:26.183Z","status":"ssl_error","status_checked_at":"2026-05-17T09:27:52.702Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["app","data","javascript","pagination","paginator","typescript"],"created_at":"2024-11-08T22:33:46.752Z","updated_at":"2026-05-17T19:03:37.838Z","avatar_url":"https://github.com/writetome51.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BigDatasetPaginator\n\n A TypeScript/JavaScript class intended for pagination where all the data to  \n be paginated can't be loaded in memory at once. Instead of only requesting  \n one page of data at-a-time from the source, the paginator has the option of  \n requesting multiple pages of data to make requests more efficient.  You  \n configure this with the functions `setItemsPerPage()` and `setItemsPerLoad()`.  \n (A load is either the total number of items you want the app to have in  \n memory at once, or the total number of items your data source is willing to  \n give you at once —— whichever is less.)  \n In the constructor you pass in a `dataSource` that returns data one load  \n at-a-time.  It must also contain a `dataTotal`.\n\n\n## Basic Usage\n\u003cdetails\u003e\n\u003csummary\u003eview basic usage\u003c/summary\u003e\n\n```ts\n// Get an instance (see constructor for dataSource details):\nlet paginator = new BigDatasetPaginator(dataSource);\n\n// Configure:\npaginator.setItemsPerPage(10);\npaginator.setItemsPerLoad(200);\n\n// itemsPerLoad / itemsPerPage must divide evenly.  If they don't,\n// itemsPerLoad will automatically lower until they do:\npaginator.setItemsPerPage(15);\npaginator.getItemsPerLoad(); // --\u003e 195\n\n// Show the first page:\nawait paginator.setCurrentPageNumber(1, {reload:true});\nconsole.log(paginator.getCurrentPage()); // '[item1, item2, item3, item4,...]'\n\n// Jump to different page:\nawait paginator.setCurrentPageNumber(5);\n```\n\u003c/details\u003e\n\n\n## Constructor\n\u003cdetails\u003e\n\u003csummary\u003eview constructor\u003c/summary\u003e\n\n```ts\nconstructor(\n    dataSource: {\n    \n        // The number of items 'getLoad()' returns must match 'itemsPerLoad'.  If\n        // 'isLastLoad' is true, it must only return the remaining items in the dataset\n        // and ignore itemsPerLoad.\n    \n        getLoad: (\n            loadNumber: number, itemsPerLoad: number, isLastLoad: boolean\n        ) =\u003e Promise\u003cany[]\u003e;\n    \n        // 'dataTotal': number of items in entire dataset, not the load.\n        // This must stay accurate after actions that change the total, such as searches.\n    \n        dataTotal: number;\n    }\n)\n```\n\u003c/details\u003e\n\n\n## Methods\n\u003cdetails\u003e\n\u003csummary\u003eview methods\u003c/summary\u003e\n\n```ts\nsetItemsPerLoad(num): void\n    // After setting this, if itemsPerLoad / itemsPerPage don't divide \n    // evenly, itemsPerLoad will lower to the closest number that will.\n\ngetItemsPerLoad(): number\n\nsetItemsPerPage(num): void\n    // After setting this, if itemsPerLoad / itemsPerPage don't divide \n    // evenly, itemsPerLoad will lower to the closest number that will.\n\ngetItemsPerPage(): number\n\ngetTotalPages(): number\n\nsetCurrentPageNumber(num, option? = {reload: false}): Promise\u003cvoid\u003e\n    // Changes the page.\n    // Set 'option.reload' to true if page data must be reloaded, \n    // for any reason, from the 'dataSource'.\n\n\ngetCurrentPageNumber(): number\n\ngetCurrentPage(): any[]\n```\n\u003c/details\u003e\n\n\n## Inheritance Chain\n\nBigDatasetPaginator\u003c--[AbstractBigDatasetPaginator](https://github.com/writetome51/abstract-big-dataset-paginator#abstractbigdatasetpaginator)\n\n\n## Installation\n`npm i  @writetome51/big-dataset-paginator`\n\n\n## Loading\n```js\nimport { BigDatasetPaginator } from '@writetome51/big-dataset-paginator';\n```\n\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwritetome51%2Fbig-dataset-paginator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwritetome51%2Fbig-dataset-paginator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwritetome51%2Fbig-dataset-paginator/lists"}