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.0 to 1.0.1

2

index.js

@@ -42,3 +42,3 @@ "use strict";

name: "next",
value: Math.min(current, current + 1),
value: Math.min(current + 1, total),
disabled: current === total,

@@ -45,0 +45,0 @@ };

{
"name": "pagination-generator",
"version": "1.0.0",
"version": "1.0.1",
"description": "pagination generator",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -22,5 +22,5 @@ # pagination generator

{ type: 'num', name: 6, value: 6, current: false },
{ type: 'nav', name: 'next', value: 4, disabled: false },
{ type: 'nav', name: 'next', value: 5, disabled: false },
{ type: 'nav', name: 'last', value: 1000, disabled: false } ]
*/
```

@@ -25,3 +25,3 @@ "use strict";

name: "next",
value: 1,
value: 2,
disabled: false,

@@ -65,5 +65,9 @@ });

const e1 = ["first", "prev", 1, 2, 3, 4, 5, "next", "last"];
const v1 = [1, 1, 1, 2, 3, 4, 5, 3, 10];
expect(getNames(
pagination(2, 10, 9)
)).to.be.eql(e1);
expect(getValues(
pagination(2, 10, 9)
)).to.be.eql(v1);

@@ -75,5 +79,9 @@ expect(getCurrentValue(

const e2 = ["first", "prev", 3, 4, 5, 6, 7, "next", "last"];
const v2 = [1, 4, 3, 4, 5, 6, 7, 6, 10];
expect(getNames(
pagination(5, 10, 9)
)).to.be.eql(e2);
expect(getValues(
pagination(5, 10, 9)
)).to.be.eql(v2);

@@ -85,5 +93,9 @@ expect(getCurrentValue(

const e3 = ["first", "prev", 6, 7, 8, 9, 10, "next", "last"];
const v3 = [1, 8, 6, 7, 8, 9, 10, 10, 10];
expect(getNames(
pagination(9, 10, 9)
)).to.be.eql(e3);
expect(getValues(
pagination(9, 10, 9)
)).to.be.eql(v3);

@@ -98,2 +110,5 @@ expect(getCurrentValue(

}
function getValues(ary) {
return ary.map(item => item.value);
}
function getCurrentValue(ary) {

@@ -100,0 +115,0 @@ return ary.filter(item => item.current)[0].value;

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