
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
@execaman/pagination
Advanced tools
import Book from "@execaman/pagination"; // ESM
// or
const Book = require("@execaman/pagination"); // CommonJS
// you can use any CDN
// preferably unpkg for latest version
<script src="https://unpkg.com/@execaman/pagination/lib/index.js" type="text/javascript"></script>
<script>
console.log(new Book([1, 2, 3, 4, 5]));
</script>
const book = new Book(
[6, 7, 8, 9, 10], // current pages
[1, 2, 3, 4, 5] // previous pages (if any)
);
console.log(book.current); // 6
list of previous pages (pages turned over)
returns: Page[]
list of current pages (pages left to read)
returns: Page[]
total number of pages
returns: number
current page number
returns: number
array of all pages; previous pages are brought to the front
returns: Page[]
the current page
returns: Page
the previous page
returns: Page
| undefined
the next page
returns: Page
| undefined
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
jump | boolean | Yes | false | whether to set the first page as the current page |
returns: Page
| undefined
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
jump | boolean | Yes | false | whether to set the last page as the current page |
returns: Page
| undefined
Parameter | Type | Optional | Description |
---|---|---|---|
page | integer | No | page number; negative to look from back, positive for front |
returns: Page
| undefined
Parameter | Type | Optional | Description |
---|---|---|---|
page | integer | No | page number; negative to look from back, positive for front |
returns: Page
| undefined
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
query | (page: Page ) => boolean | No | N/A | function to run over pages |
all | boolean | Yes | false | whether to include previous pages in query |
jump | boolean | Yes | false | whether to set it as the current page (if found) |
returns: Page
| undefined
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
jump | boolean | Yes | false | whether to set it as the curent page |
returns: Page
| undefined
erases both halves (previous and current pages) of the book, making it non-informative and non-functional
returns: void
My opinion alone won't make this package as reliable as it would be with more people; if you want to report a bug, drop a suggestion, or are willing to contribute, please do so. I shall be grateful to assist or learn from you.
Copyright (c) 2023 Aman, under the MIT License
FAQs
browse your data like a book, page by page
The npm package @execaman/pagination receives a total of 0 weekly downloads. As such, @execaman/pagination popularity was classified as not popular.
We found that @execaman/pagination demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.