Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
pagination-template
Advanced tools
Pagination of results for use in a templates in node.js. With 2 simple lines of code generate a pagination object to use in a template.
npm install pagination-template
var Pagination = require('pagination-template');
var paginator = new Pagination('search', 3, 141, 13);
var result = paginator.getPagination();
The value of variable result in this example is:
[ { url: 'search/1/13',
actualPage: false,
index: 1 },
{ url: 'search/2/13',
actualPage: false,
index: 2 },
{ url: 'search/3/13',
actualPage: true,
index: 3 },
{ url: 'search/4/13',
actualPage: false,
index: 4 },
{ url: 'search/5/13',
actualPage: false,
index: 5 },
{ url: 'search/6/13',
actualPage: false,
index: 6 },
{ url: 'search/7/13',
actualPage: false,
index: 7 },
{ url: 'search/8/13',
actualPage: false,
index: 8 },
{ url: 'search/9/13',
actualPage: false,
index: 9 },
{ url: 'search/10/13',
actualPage: false,
index: 10 },
{ url: 'search/11/13',
actualPage: false,
index: 11 } ]
The first parameter of constructor is the url path, you can indicate where is the positions of page parameters, if you send this parameter equal null the return url is a '#'
Example:
var paginator = new Pagination('search/anotherparameter/%page%/another/%rowsperpage%', 3, 141, 13);
var result = paginator.getPagination();
This return this url:
url: 'search/anotherparameter/1/another/13'
You can send optional parameters to the constructor for more customization
Example:
var parameters = {
maxPagination : 10,
showBeginingEnd: true,
domain: 'http://www.google.com',
showPreviousNext: true
};
var paginator = new pagination('search', 3, 141, 13, parameters);
Maximum number of indexes show. If for example we have a 20 pages and the maxPagination value is 10 the result is and the actual pages is 7 the result is 4 5 6 7 8 9 10 11 12 13
Check if they have to show the scroll buttons start end
If this options is passed then the url will be the concatenation of domain and the urlOrigin
Show next previous button
FAQs
Pagination of results for use in a template
The npm package pagination-template receives a total of 13 weekly downloads. As such, pagination-template popularity was classified as not popular.
We found that pagination-template 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
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.