Security News
How Threat Actors are Abusing GitHub’s File Upload Feature to Host Malware
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
paginationator
Advanced tools
Readme
Paginate an array into pages of items.
Install with npm:
$ npm install --save paginationator
var paginationator = require('paginationator');
Paginate an array with given options and return a Page
object containing an array of pages
with pagination information.
Params
arr
{Array}: Array of items to paginateoptions
{Object}: Additional options to control paginationoptions.limit
{Number}: Number of items per page (defaults to 10)returns
{Object}: paginated pagesExample
var pages = paginationator([1, 2, 3, 4, 5], {limit: 2});
//=> { pages: [
//=> { idx: 0, total: 3, current: 1, items: [1, 2], first: 1, last: 3, next: 2 },
//=> { idx: 1, total: 3, current: 2, items: [3, 4], first: 1, last: 3, prev: 1, next: 3 },
//=> { idx: 2, total: 3, current: 3, items: [5], first: 1, last: 3, prev: 2 }
//=> ]}
Page constructor
Params
page
{Object}: optional page object to populate initial values.Example
var page = new Page();
Pages constructor
Params
pages
{Array}: Optional array of pages to initialize the pages
array.Example
var pages = new Pages();
Add a page to the list.
Params
page
{Object}: Plain object or instance of a Page
returns
{Object}: Returns the instance for chainingExample
pages.addPage({items: [1, 2, 3]});
Add an array of pages to the list.
Params
pages
{Object}: Array of page objectsreturns
{Object}: Returns the instance for chainingExample
pages.addPages([...]);
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)
To generate the readme and API documentation with verb:
$ npm install -g verb verb-generate-readme && verb
Install dev dependencies:
$ npm install -d && npm test
Brian Woodward
Copyright © 2016, Brian Woodward. Released under the MIT license.
This file was generated by verb, v0.9.0, on July 19, 2016.
FAQs
Paginate an array into pages of items.
The npm package paginationator receives a total of 52,354 weekly downloads. As such, paginationator popularity was classified as popular.
We found that paginationator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.