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.6 to 1.3.7

5

dist/index.js

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

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

@@ -186,2 +186,5 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

meta[labelPrevPage] = page - 1;
} else if (page == 1 && offset !== 0) {
meta[labelHasPrevPage] = true;
meta[labelPrevPage] = 1;
} else {

@@ -188,0 +191,0 @@ meta[labelPrevPage] = null;

2

package.json
{
"name": "mongoose-paginate-v2",
"version": "1.3.6",
"version": "1.3.7",
"description": "A cursor based custom pagination library for Mongoose with customizable labels.",

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

@@ -83,3 +83,3 @@ ![Banner](static/banner.jpg)

Please note that the above properties can be renamed by setting customLabel attribute.
Please note that the above properties can be renamed by setting customLabels attribute.

@@ -86,0 +86,0 @@ ### Sample Usage

@@ -188,2 +188,5 @@ /**

meta[labelPrevPage] = (page - 1);
} else if (page == 1 && offset !== 0) {
meta[labelHasPrevPage] = true;
meta[labelPrevPage] = 1;
} else {

@@ -190,0 +193,0 @@ meta[labelPrevPage] = null;

@@ -147,3 +147,34 @@ 'use strict';

});
it('with offset and limit (not page) condition: offset > 0 < limit', function () {
var query = {
title: {
$in: [/Book/i]
}
};
var options = {
limit: 10,
offset: 5,
sort: {
_id: 1
},
lean: true
};
return Book.paginate(query, options).then((result) => {
expect(result.docs).to.have.length(10);
expect(result.totalDocs).to.equal(100);
expect(result.limit).to.equal(10);
expect(result.page).to.equal(1);
expect(result.pagingCounter).to.equal(1);
expect(result.hasPrevPage).to.equal(true);
expect(result.hasNextPage).to.equal(true);
expect(result.prevPage).to.equal(1);
expect(result.nextPage).to.equal(2);
expect(result.totalPages).to.equal(10);
});
});
it('with limit=0 (metadata only)', function () {

@@ -150,0 +181,0 @@ var query = {

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