0.1.3 • Published 6 years ago

pagify.js v0.1.3

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

Install the package

npm install pagify.js

Getting started

Add the package into your project

var pagify = require('pagify.js');

Documentation

Pagify an array

// someArray -> Array to page
// 2         -> Items per page
// Returns an object
var pages = pagify.pagify(someArray, 2);

Acess a specific page

// pages[number_of_the_page]
// Example: pages[1]
console.log(pages[1]);
// It will return an object
// {data: ['a', 'b']}

Possible error's

Arr parameter is not an array.

// Arr parameter on the function is not an array
pagify.pagify(arr, items);

Items parameter must be lower or equal to array's length.

// Items parameter on the function is bigger than the array's item
pagify.pagify(arr, items);