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

mongoose-paginate-v2

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-paginate-v2 - npm Package Compare versions

Comparing version 1.3.17 to 1.3.18

0

.eslintrc.js

@@ -0,0 +0,0 @@ module.exports = {

6

CHANGELOG.md
# Changelog
## v1.3.18
[2021-05-17]
- Fixed issue #85
## v1.3.17

@@ -4,0 +10,0 @@

@@ -0,0 +0,0 @@ # Contributor Covenant Code of Conduct

17

dist/index.js

@@ -89,3 +89,8 @@ "use strict";

var limit = parseInt(options.limit, 10) > 0 ? parseInt(options.limit, 10) : 0;
var limit = defaultOptions.limit;
if (pagination) {
limit = parseInt(options.limit, 10) > 0 ? parseInt(options.limit, 10) : 0;
}
var isCallbackSpecified = typeof callback === 'function';

@@ -122,2 +127,6 @@ var findOptions = options.options;

if (!pagination) {
page = 1;
}
var countPromise;

@@ -239,5 +248,5 @@

meta[labelLimit] = 0;
meta[labelTotalPages] = null;
meta[labelPage] = null;
meta[labelPagingCounter] = null;
meta[labelTotalPages] = 1;
meta[labelPage] = 1;
meta[labelPagingCounter] = 1;
meta[labelPrevPage] = null;

@@ -244,0 +253,0 @@ meta[labelNextPage] = null;

{
"name": "mongoose-paginate-v2",
"version": "1.3.17",
"version": "1.3.18",
"description": "A cursor based custom pagination library for Mongoose with customizable labels.",

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

@@ -79,5 +79,8 @@ /**

const limit =
parseInt(options.limit, 10) > 0 ? parseInt(options.limit, 10) : 0;
let limit = defaultOptions.limit;
if (pagination) {
limit = parseInt(options.limit, 10) > 0 ? parseInt(options.limit, 10) : 0;
}
const isCallbackSpecified = typeof callback === 'function';

@@ -117,2 +120,6 @@ const findOptions = options.options;

if (!pagination) {
page = 1;
}
let countPromise;

@@ -237,5 +244,5 @@

meta[labelLimit] = 0;
meta[labelTotalPages] = null;
meta[labelPage] = null;
meta[labelPagingCounter] = null;
meta[labelTotalPages] = 1;
meta[labelPage] = 1;
meta[labelPagingCounter] = 1;
meta[labelPrevPage] = null;

@@ -242,0 +249,0 @@ meta[labelNextPage] = null;

@@ -283,4 +283,4 @@ 'use strict';

expect(result.limit).to.equal(0);
expect(result.page).to.equal(null);
expect(result.pagingCounter).to.equal(null);
expect(result.page).to.equal(1);
expect(result.pagingCounter).to.equal(1);
expect(result.hasPrevPage).to.equal(false);

@@ -290,3 +290,3 @@ expect(result.hasNextPage).to.equal(false);

expect(result.nextPage).to.equal(null);
expect(result.totalPages).to.equal(null);
expect(result.totalPages).to.equal(1);
});

@@ -544,2 +544,29 @@ });

it('pagination=false, limit/page=undefined -> return all docs', function () {
var query = {
title: {
$in: [/Book/i],
},
};
var options = {
pagination: false,
page: undefined,
limit: undefined,
};
return Book.paginate(query, options).then((result) => {
expect(result.docs).to.have.length(100);
expect(result.totalDocs).to.equal(100);
expect(result.limit).to.equal(100);
expect(result.page).to.equal(1);
expect(result.pagingCounter).to.equal(1);
expect(result.hasPrevPage).to.equal(false);
expect(result.hasNextPage).to.equal(false);
expect(result.prevPage).to.equal(null);
expect(result.nextPage).to.equal(null);
expect(result.totalPages).to.equal(1);
});
});
after(function (done) {

@@ -546,0 +573,0 @@ mongoose.connection.db.dropDatabase(done);

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