diff --git a/index.d.ts b/index.d.ts index 02988aa..22094f1 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,29 +1,29 @@ export interface Limit { /** - * @param fn - Promise-returning/async function. - * @param arguments - Any arguments to pass through to `fn`. Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a lot of functions. - * @returns The promise returned by calling `fn(...arguments)`. - */ + @param fn - Promise-returning/async function. + @param arguments - Any arguments to pass through to `fn`. Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a lot of functions. + @returns The promise returned by calling `fn(...arguments)`. + */ ( fn: (...arguments: Arguments) => PromiseLike | ReturnType, ...arguments: Arguments ): Promise; /** - * The number of promises that are currently running. - */ + The number of promises that are currently running. + */ readonly activeCount: number; /** - * The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). - */ + The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). + */ readonly pendingCount: number; } /** - * Run multiple promise-returning & async functions with limited concurrency. - * - * @param concurrency - Concurrency limit. Minimum: `1`. - * @returns A `limit` function. - */ +Run multiple promise-returning & async functions with limited concurrency. + +@param concurrency - Concurrency limit. Minimum: `1`. +@returns A `limit` function. +*/ export default function pLimit(concurrency: number): Limit; diff --git a/package.json b/package.json index 1814549..f86dc11 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "Run multiple promise-returning & async functions with limited concurrency", "license": "MIT", "repository": "sindresorhus/p-limit", + "funding": "https://github.com/sponsors/sindresorhus", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", diff --git a/readme.md b/readme.md index 5c868f3..35b52d5 100644 --- a/readme.md +++ b/readme.md @@ -2,14 +2,12 @@ > Run multiple promise-returning & async functions with limited concurrency - ## Install ``` $ npm install p-limit ``` - ## Usage ```js @@ -30,7 +28,6 @@ const input = [ })(); ``` - ## API ### pLimit(concurrency) @@ -39,8 +36,8 @@ Returns a `limit` function. #### concurrency -Type: `number`
-Minimum: `1`
+Type: `number`\ +Minimum: `1`\ Default: `Infinity` Concurrency limit. @@ -69,13 +66,11 @@ The number of promises that are currently running. The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). - ## FAQ ### How is this different from the [`p-queue`](https://github.com/sindresorhus/p-queue) package? -This package is only about limiting the number of concurrent executions, while `p-queue` is a fully featured queue implementation with lots of different options, introspection, and ability to pause and clear the queue. - +This package is only about limiting the number of concurrent executions, while `p-queue` is a fully featured queue implementation with lots of different options, introspection, and ability to pause the queue. ## Related @@ -85,7 +80,6 @@ This package is only about limiting the number of concurrent executions, while ` - [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency - [Moreā€¦](https://github.com/sindresorhus/promise-fun) - ---