Socket
Socket
Sign inDemoInstall

co-async

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

co-async

control flow for co and generator


Version published
Weekly downloads
9
increased by800%
Maintainers
1
Weekly downloads
 
Created
Source

co-async

DEPRECATED. please use bluebird.map, it can control concurrency limit now. http://bluebirdjs.com/docs/api/promise.map.html

Build Status

quick start

var coAsync = require('co-async')
var initValues = {a: 1, b: 2, c: 3, d: 4}

var start = new Date
var values = yield coAsync.map(initValues, 1, function * (v, k) {
  yield sleep(10)
  return v * 2
});
(new Date - start).should.aboveOrEqual(40)
values.should.eql({a: 2, b: 4, c: 6, d: 8})

API

map(obj, gen)

map(obj, limit, gen)

obj -- array or object. e.g. [1,2,3,4] or {a: 1, b: 2}

limit -- concurrency limit

gen -- a generator

Keywords

FAQs

Package last updated on 19 Oct 2017

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

  • 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