3.0.1 • Published 1 year ago

ts-pagination v3.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
1 year ago

ts-pagination Build Status npm

Pagination for Nodejs and JavaScript..

🔥🔥🔥 Break Change 🔥🔥🔥

I rewrite it to 3.0 making performance better and size smaller. So if you use 3.0 above, please check "How to use" section again.

Install

$ npm install ts-pagination --save

How to use

import { getSimplePagination } from "ts-pagination";

const data = [
  { id: "1", name: "bb0", age: 25 },
  { id: "2", name: "bb1", age: 26 },
  { id: "3", name: "bb2", age: 27 },
  { id: "4", name: "bb3", age: 28 },
  { id: "5", name: "bb4", age: 29 },
  { id: "6", name: "bb5", age: 210 },
];

const sPagination = getSimplePagination(
  {
    currentPage: 1,
    size: 5,
    total: data.length,
  },
  3,
  {
    firstText: "first",
    lastText: "last",
    preGroupText: "<<",
    nextGroupText: ">>",
    PreText: "<",
    nextText: ">",
    isShowFirstLastItem: true,
    isShowPrevNextGroupItem: true,
    isShowPrevNextItem: true,
  }
);
console.log(sPagination);

Demo

playground

Todos

  • UI demo
  • testing
  • middle pagination

Code Coverage

-------------------------|---------|----------|---------|---------|-------------------
File                     | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-------------------------|---------|----------|---------|---------|-------------------
All files                |     100 |      100 |     100 |     100 |
 src                     |     100 |      100 |     100 |     100 |
  _index.ts              |     100 |      100 |     100 |     100 |
 src/code                |     100 |      100 |     100 |     100 |
  core.ts                |     100 |      100 |     100 |     100 |
  getSimplePagination.ts |     100 |      100 |     100 |     100 |
-------------------------|---------|----------|---------|---------|-------------------

Workspace

docker run --rm -it \
  -w /app \
  -v $(pwd):/app \
  -p 3000:3000 \
  -p 10000:10000 \
  -p 24678:24678 \
  node:16.19-alpine /bin/sh

apk add --no-cache bash &&\
	npm i -g pnpm
3.0.1

1 year ago

3.0.0

1 year ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago