This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@sphido/pagination

1.1.0 • Public • Published

@sphido/pagination

Allow paginate over pages return follow structure:

{
  "posts": [ "... array of pages" ],
  "current": "number of current page",
  "pages": ["... array of other pages"]
}

Install

yarn add @sphido/pagination

Usage

import {pagination} from "@sphido/pagination";

const posts = [
  {title: 'First title'},
  {title: 'Second title'},
  {title: 'Another title'},
  {title: 'And last one'}
];

(async () => {
  const pages = pagination(posts, 3);
  for await (const page of pages) {
	console.log(page.posts); // list of posts on current page
	console.log(page.current); // current page no
	console.log(page.pages); // array of other pages
  }
})();

Source codes

https://github.com/sphido/sphido/tree/main/packages/sphido-pagination

Readme

Keywords

none

Package Sidebar

Install

npm i @sphido/pagination

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

2.9 kB

Total Files

4

Last publish

Collaborators

  • ozzyczech