Socket
Book a DemoInstallSign in
Socket

cargo-p

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

cargo-p

Usage:

1.0.4
latest
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Usage:

function jobHandler(jobs){

	// in this example, jobs is an array of size 1-3
	jobs.forEach(function(job){

		// job {
		// 	  item:    XXX,
		// 	  resolve: function,
		// 	  reject:  function,
		// 	  promise: Promise
		// }

		if (job.item > 10) {
			job.resolve('this number is greater than 10');
		}

		// use job.reject() to fail a job
		// any jobs not resolved after any returned promises have resolved, will automatically be rejected
		
	});
}

var batchThisJob = cargo(jobHandler, {size: 3, delay: 200});

batchThisJob(563);
batchThisJob(75);
batchThisJob(2);
// jobHandler([{item:563, ...}, {item:75, ...}, ...])
batchThisJob(43);
// jobHandler([{item:43}]) // (after 200 ms)

FAQs

Package last updated on 31 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.