Socket
Socket
Sign inDemoInstall

cosa

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cosa - npm Package Compare versions

Comparing version 3.0.10 to 3.0.11

20

lib/cursor.js

@@ -0,1 +1,2 @@

const { times } = require('omnibelt');
/**

@@ -31,2 +32,21 @@ * Wrapper around MongoDB Cursor to convert results to Models.

/**
* Executes the iterator for the max number of items in parallel.
* @param {number} maxParallel - the max number of items to run in parallel
* @param {function} iterator - a function that will be called for each doc
* @returns {Promise} - resolves when list is exhausted.
*/
async forEachParallelLimitP(maxParallel, iterator) {
if (!maxParallel || maxParallel < 1) { maxParallel = 1; }
const itemWrapper = async () => {
if (this.isClosed()) { return; }
const item = await this.next();
if (!item) { return; }
await iterator(item);
return itemWrapper();
};
const promises = times(itemWrapper, maxParallel);
return Promise.all(promises);
}
/**
* Returns the count of documents on the cursor.

@@ -33,0 +53,0 @@ * @param {boolean} applySkipLimit - the number of docs to skip over in the count

2

package.json
{
"name": "cosa",
"version": "3.0.10",
"version": "3.0.11",
"description": "Cosa Models for MongoDB",

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

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