npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pagination-front-end

v1.0.5

Published

pagination-front-end é uma biblioteca voltada para realização de paginação no front end( pagination-front-end is a front-end paging library)

Downloads

41

Readme

pagination-front-end(Paginação no front end)

# Instalação(Installation)
$ npm i pagination-front-end || yarn add pagination-front-end
# Clone este repositório(Clone this repository)
$ git clone https://github.com/jhony2488/pagination-frontend

# Acesse a pasta do projeto no terminal/cmd(Access the project folder in the terminal/cmd)
$ cd pagination-frontend

# Instale as dependências(install dependencies)
$ npm install || yarn add
const pagination = require('pagination-front-end'); // or import pagination from 'pagination-front-end' in typescript

const drones = [
  {
    id: 3,
    image: 'https://robohash.org/fugaaperiamofficiis.jpg?size=50x50&set=set1',
    name: 'Gabbie',
    address: '559 Moose Street',
    battery: 15,
    max_speed: 37.7,
    average_speed: 18.7,
    status: 'flying',
    fly: 76,
  },
  {
    id: 4,
    image: 'https://robohash.org/quiavoluptatemillum.jpg?size=50x50&set=set1',
    name: 'Audrie',
    address: '9460 Canary Junction',
    battery: 49,
    max_speed: 19.4,
    average_speed: 19.1,
    status: 'flying',
    fly: 26,
  },
  {
    id: 5,
    image: 'https://robohash.org/liberoperferendissapiente.jpg?size=50x50&set=set1',
    name: 'Doreen',
    address: '62 Rusk Avenue',
    battery: 56,
    max_speed: 35.7,
    average_speed: 22.8,
    status: 'flying',
    fly: 27,
  },
  {
    id: 6,
    image: 'https://robohash.org/quaecumqueid.bmp?size=50x50&set=set1',
    name: 'Gustaf',
    address: '687 Grim Place',
    battery: 70,
    max_speed: 38.7,
    average_speed: 1.6,
    status: 'flying',
    fly: 67,
  },
  {
    id: 7,
    image: 'https://robohash.org/omnisquiamet.jpg?size=50x50&set=set1',
    name: 'Othilie',
    address: '0249 Daystar Park',
    battery: 50,
    max_speed: 12.7,
    average_speed: 10.2,
    status: 'flying',
    fly: 41,
  },
  {
    id: 8,
    image: 'https://robohash.org/quiavoluptasut.png?size=50x50&set=set1',
    name: 'Rosene',
    address: '7016 Shelley Circle',
    battery: 51,
    max_speed: 3.3,
    average_speed: 9.2,
    status: 'charging',
    fly: 35,
  },
  {
    id: 9,
    image: 'https://robohash.org/nonoccaecatitemporibus.bmp?size=50x50&set=set1',
    name: 'Franklin',
    address: '63991 Rigney Point',
    battery: 21,
    max_speed: 40.5,
    average_speed: 5,
    status: 'charging',
    fly: 0,
  },
  {
    id: 10,
    image: 'https://robohash.org/doloresnonsit.bmp?size=50x50&set=set1',
    name: 'Lynel',
    address: '3080 Ludington Alley',
    battery: 73,
    max_speed: 27.3,
    average_speed: 15.7,
    status: 'success',
    fly: 18,
  },
  {
    id: 11,
    image: 'https://robohash.org/adautemenim.bmp?size=50x50&set=set1',
    name: 'Gunar',
    address: '15295 Crowley Lane',
    battery: 86,
    max_speed: 37.5,
    average_speed: 14,
    status: 'flying',
    fly: 66,
  },
  {
    id: 12,
    image: 'https://robohash.org/quisdoloreearum.jpg?size=50x50&set=set1',
    name: 'Kasey',
    address: '064 Delaware Lane',
    battery: 51,
    max_speed: 3.2,
    average_speed: 9.1,
    status: 'repair',
    fly: 43,
  },
  {
    id: 13,
    image: 'https://robohash.org/rationenonpossimus.png?size=50x50&set=set1',
    name: 'Delly',
    address: '6533 Basil Crossing',
    battery: 67,
    max_speed: 25,
    average_speed: 28,
    status: 'flying',
    fly: 91,
  },
  {
    id: 14,
    image: 'https://robohash.org/suscipitvelofficiis.jpg?size=50x50&set=set1',
    name: 'Norma',
    address: '80060 Riverside Drive',
    battery: 16,
    max_speed: 18.9,
    average_speed: 3.6,
    status: 'repair',
    fly: 90,
  },
];
// Pagination.pagination(items: any[], currentPage: number = 1, pageSize: number = 20) 
const paginationPage1= pagination(drones, 1, 5);

// Pagination.pagination(items: any[], currentPage: number = 1, pageSize: number = 20) 
const paginationPage2= pagination(drones, 2, 5);

console.log(paginationPage1)
/*
{
  AllItems: 12,
  currentPage: 1,
  pageSize: 5,
  allPages: 2,
  startPage: 1,
  endPage: 2,
  startIndex: 0,
  endIndex: 4,
  pages: [ 1, 2 ],
  items: [
    {
      id: 3,
      image: 'https://robohash.org/fugaaperiamofficiis.jpg?size=50x50&set=set1',
      name: 'Gabbie',
      address: '559 Moose Street',
      battery: 15,
      max_speed: 37.7,
      average_speed: 18.7,
      status: 'flying',
      fly: 76
    },
    {
      id: 4,
      image: 'https://robohash.org/quiavoluptatemillum.jpg?size=50x50&set=set1',
      name: 'Audrie',
      address: '9460 Canary Junction',
      battery: 49,
      max_speed: 19.4,
      average_speed: 19.1,
      status: 'flying',
      fly: 26
    },
    {
      id: 5,
      image: 'https://robohash.org/liberoperferendissapiente.jpg?size=50x50&set=set1',
      name: 'Doreen',
      address: '62 Rusk Avenue',
      battery: 56,
      max_speed: 35.7,
      average_speed: 22.8,
      status: 'flying',
      fly: 27
    },
    {
      id: 6,
      image: 'https://robohash.org/quaecumqueid.bmp?size=50x50&set=set1',
      name: 'Gustaf',
      address: '687 Grim Place',
      battery: 70,
      max_speed: 38.7,
      average_speed: 1.6,
      status: 'flying',
      fly: 67
    },
    {
      id: 7,
      image: 'https://robohash.org/omnisquiamet.jpg?size=50x50&set=set1',
      name: 'Othilie',
      address: '0249 Daystar Park',
      battery: 50,
      max_speed: 12.7,
      average_speed: 10.2,
      status: 'flying',
      fly: 41
    }
  ]
}
*/

console.log(paginationPage2)
/*
{
  AllItems: 12,
  currentPage: 2,
  pageSize: 5,
  allPages: 2,
  startPage: 1,
  endPage: 2,
  startIndex: 5,
  endIndex: 9,
  pages: [ 1, 2 ],
  items: [
    {
      id: 8,
      image: 'https://robohash.org/quiavoluptasut.png?size=50x50&set=set1',
      name: 'Rosene',
      address: '7016 Shelley Circle',
      battery: 51,
      max_speed: 3.3,
      average_speed: 9.2,
      status: 'charging',
      fly: 35
    },
    {
      id: 9,
      image: 'https://robohash.org/nonoccaecatitemporibus.bmp?size=50x50&set=set1',
      name: 'Franklin',
      address: '63991 Rigney Point',
      battery: 21,
      max_speed: 40.5,
      average_speed: 5,
      status: 'charging',
      fly: 0
    },
    {
      id: 10,
      image: 'https://robohash.org/doloresnonsit.bmp?size=50x50&set=set1',
      name: 'Lynel',
      address: '3080 Ludington Alley',
      battery: 73,
      max_speed: 27.3,
      average_speed: 15.7,
      status: 'success',
      fly: 18
    },
    {
      id: 11,
      image: 'https://robohash.org/adautemenim.bmp?size=50x50&set=set1',
      name: 'Gunar',
      address: '15295 Crowley Lane',
      battery: 86,
      max_speed: 37.5,
      average_speed: 14,
      status: 'flying',
      fly: 66
    },
    {
      id: 12,
      image: 'https://robohash.org/quisdoloreearum.jpg?size=50x50&set=set1',
      name: 'Kasey',
      address: '064 Delaware Lane',
      battery: 51,
      max_speed: 3.2,
      average_speed: 9.1,
      status: 'repair',
      fly: 43
    }
  ]
}
*/

//pegar somente os itens 
// get only the items
console.log(paginationPage1.items)
/*
 [
    {
      id: 3,
      image: 'https://robohash.org/fugaaperiamofficiis.jpg?size=50x50&set=set1',
      name: 'Gabbie',
      address: '559 Moose Street',
      battery: 15,
      max_speed: 37.7,
      average_speed: 18.7,
      status: 'flying',
      fly: 76
    },
    {
      id: 4,
      image: 'https://robohash.org/quiavoluptatemillum.jpg?size=50x50&set=set1',
      name: 'Audrie',
      address: '9460 Canary Junction',
      battery: 49,
      max_speed: 19.4,
      average_speed: 19.1,
      status: 'flying',
      fly: 26
    },
    {
      id: 5,
      image: 'https://robohash.org/liberoperferendissapiente.jpg?size=50x50&set=set1',
      name: 'Doreen',
      address: '62 Rusk Avenue',
      battery: 56,
      max_speed: 35.7,
      average_speed: 22.8,
      status: 'flying',
      fly: 27
    },
    {
      id: 6,
      image: 'https://robohash.org/quaecumqueid.bmp?size=50x50&set=set1',
      name: 'Gustaf',
      address: '687 Grim Place',
      battery: 70,
      max_speed: 38.7,
      average_speed: 1.6,
      status: 'flying',
      fly: 67
    },
    {
      id: 7,
      image: 'https://robohash.org/omnisquiamet.jpg?size=50x50&set=set1',
      name: 'Othilie',
      address: '0249 Daystar Park',
      battery: 50,
      max_speed: 12.7,
      average_speed: 10.2,
      status: 'flying',
      fly: 41
    }
  ]

*/
//pegar somente os itens 
// get only the items
console.log(paginationPage2.items)

/*
[
    {
      id: 8,
      image: 'https://robohash.org/quiavoluptasut.png?size=50x50&set=set1',
      name: 'Rosene',
      address: '7016 Shelley Circle',
      battery: 51,
      max_speed: 3.3,
      average_speed: 9.2,
      status: 'charging',
      fly: 35
    },
    {
      id: 9,
      image: 'https://robohash.org/nonoccaecatitemporibus.bmp?size=50x50&set=set1',
      name: 'Franklin',
      address: '63991 Rigney Point',
      battery: 21,
      max_speed: 40.5,
      average_speed: 5,
      status: 'charging',
      fly: 0
    },
    {
      id: 10,
      image: 'https://robohash.org/doloresnonsit.bmp?size=50x50&set=set1',
      name: 'Lynel',
      address: '3080 Ludington Alley',
      battery: 73,
      max_speed: 27.3,
      average_speed: 15.7,
      status: 'success',
      fly: 18
    },
    {
      id: 11,
      image: 'https://robohash.org/adautemenim.bmp?size=50x50&set=set1',
      name: 'Gunar',
      address: '15295 Crowley Lane',
      battery: 86,
      max_speed: 37.5,
      average_speed: 14,
      status: 'flying',
      fly: 66
    },
    {
      id: 12,
      image: 'https://robohash.org/quisdoloreearum.jpg?size=50x50&set=set1',
      name: 'Kasey',
      address: '064 Delaware Lane',
      battery: 51,
      max_speed: 3.2,
      average_speed: 9.1,
      status: 'repair',
      fly: 43
    }
  ]

*/
# Executar os testes(Run the tests)
$ npm run test || yarn test

Português: As seguintes ferramentas foram usadas na construção desta biblioteca: English: The following tools were used in building this library:

Obs: A build para javascript de publicação e executada automaticamente.

MIT