New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tiny-data-pagination

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tiny-data-pagination

Add pagination to data array

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Tiny Data Pagination

Prize

$25 CAD Amazon gift card + bragging rights.

Tip: Read the General Information Document for more info on how to get started and submit.

Installation

Installation is done using the [npm install command]:

$ npm install tiny-data-pagination

Usage

Use it in your app

  1. require [tiny-data-pagination]
const Pagination = require('tiny-data-pagination')
  1. Create a [tiny-data-pagination] object
const Pagination = require('tiny-data-pagination')

let data = [2, 4, 6, 22, 4, 6, 2, 12]

let pagedData = new Pagination(2, data)
// new Pagination(pageSize, data)
  1. Use [tiny-data-pagination]
const Pagination = require('tiny-data-pagination')

let data = [2, 4, 6, 22, 4, 6, 2, 12]

let pagedData = new Pagination(2, data)

console.log(pagedData.getPageData(1)) // [ 2, 4 ]
console.log(pagedData.nextPage()) // [ 6, 22 ]
console.log(pagedData.sortData(0)) // [ 2, 2, 4, 4, 6, 6, 12, 22 ]

Methods

pagedData.getPageData(pageNo) Returns the data of the page number(number) you passed.

pagedData.getPageLength() Returns the length of pages.

pagedData.getCurrentPageNo() Returns the current page number.

pagedData.setData(newData) Reset your data as the newData you passed in .

pagedData.nextPage() Returns the data of next page.

pagedData.previousPage() Returns the data of previous page.

pagedData.setPageSize(pageSize) Reset the page size ad the pageSize(number) you passed in .

pagedData.sortData(sortType, keyName) Sort the data based on the keyName(string) of each object. If it's an array you don't need pass it. sortType is a number [0] or [1]. [0] means [ascending]; [1] means [descending];

Keywords

FAQs

Package last updated on 17 Apr 2020

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