sig-pagination

1.0.9 • Public • Published

Repo Size npm version npm license npm downloads Coverage Status HitCount

what is this?

Pagination for array items and set items in map of javascript

instalation

npm i sig-pagination --save

options

items = array
page = int, number page of params example: "page?p=2"
maxperpage = int, max pagination example 5: [1,2,3,4,5,next]
show = int, max items per page.

functions

0: {i: 0, active: true, page: 4}
1: {i: 5, active: true, page: 5}
2: {i: 6, active: false, page: 6}
3: {i: 7, active: false, page: 7}
4: {i: 8, active: false, page: 8}
5: {i: 9, active: false, page: 9}
6: {i: 10, active: false, page: 10}
7: {i: 999999, active: true, page: 6}

active, is a active page
page, is a page params
i = pages
i = 0 page arrow left
i = 999999 arrow right

examples

import { items, pagination, from, to, total } from "sig-pagination"

for list items

var products = items({
    maxperpage: 6,
    show: 5,
    items: productsd,
    page: page
  })

list pagination

  const pagination2 = pagination({
    maxperpage: 6,
    show: 5,
    items: productsd,
    page: page
  })

show from number example: 1 to 10 items

  const from2 = from({
    maxperpage: 6,
    show: 5,
    items: productsd,
    page: page
  })

show to number example: 1 to 10 items

  const to2 = to({
    items: productsd,
    show: 5,
    maxperpage: 6,
    page: page
  })

show total count items example: 1 to 10 items of 10 Total

  const total2 = total({
    maxperpage: 6,
    items: productsd,
    page: page
  })

EXAMPLE USAGE IN NEXTJS/ REACT

HERE

Package Sidebar

Install

npm i sig-pagination

Weekly Downloads

0

Version

1.0.9

License

GPL

Unpacked Size

8.56 kB

Total Files

4

Last publish

Collaborators

  • nicknickolasm4