await-parallel-limit
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

await-parallel-limit

npm install await-parallel-limit --save

Processes an array of async functions with concurrency limit (default limit is 5).

API

parallel(
    Array jobs,
    Integer concurrency,
)

Typescript

import parallel from 'await-parallel-limit'
 
const jobs = [
    async () { return await true },
    async () { return await 2 },
] as const
 
// results array is typed based on return types of async functions
// it is an ordered tuple of types
 
// const results: [ boolean, number ]
const results = await parallel(jobs, 2)

Javascript

const parallel = require('await-parallel-limit').default
 
var jobs = [
    async () { ... },
    async () { ... },
    async () { ... },
    async () { ... }
]
 
var results = await parallel(jobs, 2)

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i await-parallel-limit

      Weekly Downloads

      1,031

      Version

      2.1.0

      License

      ISC

      Unpacked Size

      9.92 kB

      Total Files

      10

      Last publish

      Collaborators

      • acro