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.10 to 1.3.11

20

dist/index.js
"use strict";
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

@@ -65,3 +69,3 @@

function paginate(query, options, callback) {
options = _objectSpread({}, defaultOptions, {}, paginate.options, {}, options);
options = _objectSpread(_objectSpread(_objectSpread({}, defaultOptions), paginate.options), options);
query = query || {};

@@ -81,3 +85,3 @@ var _options = options,

var customLabels = _objectSpread({}, defaultOptions.customLabels, {}, options.customLabels);
var customLabels = _objectSpread(_objectSpread({}, defaultOptions.customLabels), options.customLabels);

@@ -123,3 +127,3 @@ var limit = parseInt(options.limit, 10) > 0 ? parseInt(options.limit, 10) : 0;

if (useEstimatedCount === true) {
countPromise = this.useEstimatedCount(query).exec();
countPromise = this.estimatedDocumentCount().exec();
} else {

@@ -164,3 +168,5 @@ countPromise = this.countDocuments(query).exec();

docs.forEach(function (doc) {
doc.id = String(doc._id);
if (doc._id) {
doc.id = String(doc._id);
}
});

@@ -167,0 +173,0 @@ return docs;

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

@@ -42,24 +42,24 @@ "main": "dist/index.js",

"devDependencies": {
"@babel/cli": "^7.4.3",
"@babel/core": "^7.4.3",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-proposal-do-expressions": "^7.0.0",
"@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-function-bind": "^7.0.0",
"@babel/plugin-proposal-function-sent": "^7.0.0",
"@babel/plugin-proposal-json-strings": "^7.0.0",
"@babel/plugin-proposal-logical-assignment-operators": "^7.0.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
"@babel/plugin-proposal-optional-chaining": "^7.0.0",
"@babel/plugin-proposal-pipeline-operator": "^7.0.0",
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/preset-env": "^7.3.1",
"@babel/cli": "^7.12.1",
"@babel/core": "^7.12.3",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-decorators": "^7.12.1",
"@babel/plugin-proposal-do-expressions": "^7.12.1",
"@babel/plugin-proposal-export-default-from": "^7.12.1",
"@babel/plugin-proposal-export-namespace-from": "^7.12.1",
"@babel/plugin-proposal-function-bind": "^7.12.1",
"@babel/plugin-proposal-function-sent": "^7.12.1",
"@babel/plugin-proposal-json-strings": "^7.12.1",
"@babel/plugin-proposal-logical-assignment-operators": "^7.12.1",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1",
"@babel/plugin-proposal-numeric-separator": "^7.12.5",
"@babel/plugin-proposal-optional-chaining": "^7.12.1",
"@babel/plugin-proposal-pipeline-operator": "^7.12.1",
"@babel/plugin-proposal-throw-expressions": "^7.12.1",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.10.4",
"@babel/preset-env": "^7.12.1",
"chai": "^4.2.0",
"mocha": "^6.0.1",
"mongoose": "^5.2.4"
"mocha": "^8.2.1",
"mongoose": "^5.10.12"
},

@@ -69,2 +69,2 @@ "engines": {

}
}
}

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

- `[pagination]` {Boolean} - If `pagination` is set to false, it will return all docs without adding limit condition. (Default: True)
- `[useEstimatedCount]` - Enable estimatedDocumentCount for larger datasets. As the name says, the count may not abe accurate. (Default: False)
- `[useEstimatedCount]` - Enable [estimatedDocumentCount](https://docs.mongodb.com/manual/reference/method/db.collection.estimatedDocumentCount/) for larger datasets. Does not count based on given query, so the count will match entire collection size. (Default: False)
- `[forceCountFn]` {Boolean} - Set this to true, if you need to support $geo queries. (Default: False)

@@ -323,4 +323,8 @@ - `[read]` {Object} - Determines the MongoDB nodes from which to read. Below are the available options.

[v1.3.11] - 6/11/2020
- Fixes to estimateDocumentCount implementation.
- Package version updates to support Node v12.
## License
[MIT](LICENSE)

@@ -119,3 +119,3 @@ /**

if (useEstimatedCount === true) {
countPromise = this.useEstimatedCount(query).exec()
countPromise = this.estimatedDocumentCount().exec()
} else {

@@ -160,3 +160,5 @@ countPromise = this.countDocuments(query).exec();

docs.forEach((doc) => {
doc.id = String(doc._id);
if(doc._id) {
doc.id = String(doc._id);
}
});

@@ -163,0 +165,0 @@ return docs;

@@ -5,2 +5,3 @@ 'use strict';

let expect = require('chai').expect;
let assert = require('chai').assert;
let mongoosePaginate = require('../dist/index');

@@ -476,2 +477,11 @@

it('estimated count works', function (done) {
Book.paginate({}, { useEstimatedCount: true }, function (err, result) {
expect(err).to.be.null;
expect(result).to.be.an.instanceOf(Object);
assert.isNumber(result.totalDocs, 'totalDocs is a number');
done();
});
});
after(function (done) {

@@ -478,0 +488,0 @@ mongoose.connection.db.dropDatabase(done);

Sorry, the diff of this file is not supported yet

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