Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@matrixai/pagination

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@matrixai/pagination

Offset-based and cursor-based pagination utilities

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Pagination

Offset

Offset pagination relies on a seek and limit number.

Consider the resource we are paginating is:

['A', 'B', 'C', 'D']

The seek index starts at 0.

The limit is the desired length of the returned pagination view.

A seek and limit of [0, 2] would return ['A', 'B'].

Page numbers start from 1. However we refer to them with a page index that starts at 0.

The total represents the total number of items when the pagination was fetched. The true total of items may have changed on the server side since fetching a pagination.

Cursor

Cursor pagination relies on unique orderable seek key.

Consider the resource we are paginating is:

['A', 'B', 'C', 'D']

Assume that the seek key is [0, 1, 2, 3]:

  • Using order = true, seek = 0 and limit = 2, you would get ['B', 'C'].
  • Using order = false, seek = 2 and limit = 2, you would get ['A', 'B'].
  • Using order = null, seekAfter = 1, seekBefore = 3, you would get ['C'].

Cursor pagination does not allow random access of the pages. You can however randomly access if you know the seek key you want.

Development

type='patch'
npm run build
npm version $type
npm publish

Keywords

FAQs

Package last updated on 10 Oct 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc