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

pagination-generator

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pagination-generator - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

index.umd.js

22

index.js

@@ -19,5 +19,5 @@ "use strict";

*/
module.exports = function pagination(current, total, limit) {
export default function paginationGenerator(current, total, limit) {
current = Math.min(total, Math.max(1, current));
var first = {
let first = {
type: "nav",

@@ -28,3 +28,3 @@ name: "first",

};
var last = {
let last = {
type: "nav",

@@ -35,3 +35,3 @@ name: "last",

};
var prev = {
let prev = {
type: "nav",

@@ -42,3 +42,3 @@ name: "prev",

};
var next = {
let next = {
type: "nav",

@@ -61,4 +61,4 @@ name: "next",

}
var start = 1, end = total;
var before = [], after = [];
let start = 1, end = total;
let before = [], after = [];
if (total > limit) {

@@ -68,3 +68,3 @@ before = [first, prev];

limit -= 4;
var half = Math.floor(limit / 2);
let half = Math.floor(limit / 2);
if (current <= half) {

@@ -79,4 +79,4 @@ end = limit;

}
var pages = [];
for (var i = start; i <= end; i++) {
let pages = [];
for (let i = start; i <= end; i++) {
pages.push({

@@ -90,2 +90,2 @@ type: "num",

return before.concat(pages, after);
};
}
{
"name": "pagination-generator",
"version": "1.0.2",
"version": "1.0.3",
"description": "pagination generator",
"main": "index.js",
"main": "index.umd.js",
"jsnext:main": "index.js",
"scripts": {
"test": "mocha test.js"
"test": "mocha test.js",
"build": "rollup -c rollup.config.js"
},

@@ -16,4 +18,8 @@ "keywords": [

"devDependencies": {
"babel-core": "^6.7.4",
"babel-preset-es2015-rollup": "^1.1.1",
"chai": "^3.5.0",
"mocha": "^2.4.5"
"mocha": "^2.4.5",
"rollup": "^0.25.6",
"rollup-plugin-babel": "^2.4.0"
},

@@ -20,0 +26,0 @@ "dependencies": {},

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