Socket
Socket
Sign inDemoInstall

cargo-p

Package Overview
Dependencies
2
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cargo-p

Usage:


Version published
Weekly downloads
5
increased by400%
Maintainers
1
Created
Weekly downloads
 

Readme

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

Last updated on 31 Jul 2015

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc