Socket
Socket
Sign inDemoInstall

array-paginate

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    array-paginate

A javascript library to paginate arrays


Version published
Maintainers
1
Install size
2.35 kB
Created

Readme

Source

Array Paginate (array-paginate)

Array paginate is a library that takes in an array and paginate it to suit the needs of users.

Installation

Use the package manager [npm] to install array-paginate.

npm install array-paginate

Arguments

arrayPaginate(array, page, limit)
argumenttypedefaultdescription
arrayArrayundefinedThe array of items that is to be paginated
pageNumber1The page number to return from the pagination
limitNumber10The number of items to be returned for each page

Usage


var arrayPaginate = require('array-paginate');
const array = ["first","second","third","fourth", "fifth"]
const paginatedItems = arrayPaginate(array, 1, 3);

console.log(paginatedItems);
//Returns
/*
{
	docs: ["first","second","third"],
	currentPage: 1,
	perPage: 3,
	total: 5,
	totalPages: 2,
	hasNextPage: true,
	hasPrevPage: false
}
*/

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Keywords

FAQs

Last updated on 18 May 2019

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc