+21
-171
@@ -1,8 +0,8 @@ | ||
| declare namespace pAll { | ||
| type Options = import('p-map').Options; | ||
| import {Options} from 'p-map'; | ||
| type PromiseFactory<T> = () => PromiseLike<T>; | ||
| } | ||
| type PromiseFactory<T> = () => PromiseLike<T>; | ||
| // TODO: Refactor the whole definition back to multiple overloaded functions | ||
| // From: https://github.com/microsoft/TypeScript/blob/4f5b3299fee9a54b692aba9df7a9e894bd86e81d/src/lib/es2015.promise.d.ts#L1 | ||
| type Awaited<T> = T extends undefined ? T : T extends PromiseLike<infer U> ? U : T; | ||
| /** | ||
@@ -16,172 +16,22 @@ Run promise-returning & async functions concurrently with optional limited concurrency. | ||
| ``` | ||
| import pAll = require('p-all'); | ||
| import got = require('got'); | ||
| import pAll from 'p-all'; | ||
| import got from 'got'; | ||
| (async () => { | ||
| const actions = [ | ||
| () => got('https://sindresorhus.com'), | ||
| () => got('https://ava.li'), | ||
| () => checkSomething(), | ||
| () => doSomethingElse() | ||
| ]; | ||
| const actions = [ | ||
| () => got('https://sindresorhus.com'), | ||
| () => got('https://avajs.dev'), | ||
| () => checkSomething(), | ||
| () => doSomethingElse() | ||
| ]; | ||
| console.log(await pAll(actions, {concurrency: 2})); | ||
| })(); | ||
| console.log(await pAll(actions, {concurrency: 2})); | ||
| ``` | ||
| */ | ||
| declare const pAll: { | ||
| < | ||
| Result1, | ||
| Result2, | ||
| Result3, | ||
| Result4, | ||
| Result5, | ||
| Result6, | ||
| Result7, | ||
| Result8, | ||
| Result9, | ||
| Result10 | ||
| >( | ||
| tasks: [ | ||
| pAll.PromiseFactory<Result1>, | ||
| pAll.PromiseFactory<Result2>, | ||
| pAll.PromiseFactory<Result3>, | ||
| pAll.PromiseFactory<Result4>, | ||
| pAll.PromiseFactory<Result5>, | ||
| pAll.PromiseFactory<Result6>, | ||
| pAll.PromiseFactory<Result7>, | ||
| pAll.PromiseFactory<Result8>, | ||
| pAll.PromiseFactory<Result9>, | ||
| pAll.PromiseFactory<Result10> | ||
| ], | ||
| options?: pAll.Options | ||
| ): Promise< | ||
| [ | ||
| Result1, | ||
| Result2, | ||
| Result3, | ||
| Result4, | ||
| Result5, | ||
| Result6, | ||
| Result7, | ||
| Result8, | ||
| Result9, | ||
| Result10 | ||
| ] | ||
| >; | ||
| < | ||
| Result1, | ||
| Result2, | ||
| Result3, | ||
| Result4, | ||
| Result5, | ||
| Result6, | ||
| Result7, | ||
| Result8, | ||
| Result9 | ||
| >( | ||
| tasks: [ | ||
| pAll.PromiseFactory<Result1>, | ||
| pAll.PromiseFactory<Result2>, | ||
| pAll.PromiseFactory<Result3>, | ||
| pAll.PromiseFactory<Result4>, | ||
| pAll.PromiseFactory<Result5>, | ||
| pAll.PromiseFactory<Result6>, | ||
| pAll.PromiseFactory<Result7>, | ||
| pAll.PromiseFactory<Result8>, | ||
| pAll.PromiseFactory<Result9> | ||
| ], | ||
| options?: pAll.Options | ||
| ): Promise< | ||
| [ | ||
| Result1, | ||
| Result2, | ||
| Result3, | ||
| Result4, | ||
| Result5, | ||
| Result6, | ||
| Result7, | ||
| Result8, | ||
| Result9 | ||
| ] | ||
| >; | ||
| <Result1, Result2, Result3, Result4, Result5, Result6, Result7, Result8>( | ||
| tasks: [ | ||
| pAll.PromiseFactory<Result1>, | ||
| pAll.PromiseFactory<Result2>, | ||
| pAll.PromiseFactory<Result3>, | ||
| pAll.PromiseFactory<Result4>, | ||
| pAll.PromiseFactory<Result5>, | ||
| pAll.PromiseFactory<Result6>, | ||
| pAll.PromiseFactory<Result7>, | ||
| pAll.PromiseFactory<Result8> | ||
| ], | ||
| options?: pAll.Options | ||
| ): Promise< | ||
| [Result1, Result2, Result3, Result4, Result5, Result6, Result7, Result8] | ||
| >; | ||
| <Result1, Result2, Result3, Result4, Result5, Result6, Result7>( | ||
| tasks: [ | ||
| pAll.PromiseFactory<Result1>, | ||
| pAll.PromiseFactory<Result2>, | ||
| pAll.PromiseFactory<Result3>, | ||
| pAll.PromiseFactory<Result4>, | ||
| pAll.PromiseFactory<Result5>, | ||
| pAll.PromiseFactory<Result6>, | ||
| pAll.PromiseFactory<Result7> | ||
| ], | ||
| options?: pAll.Options | ||
| ): Promise<[Result1, Result2, Result3, Result4, Result5, Result6, Result7]>; | ||
| <Result1, Result2, Result3, Result4, Result5, Result6>( | ||
| tasks: [ | ||
| pAll.PromiseFactory<Result1>, | ||
| pAll.PromiseFactory<Result2>, | ||
| pAll.PromiseFactory<Result3>, | ||
| pAll.PromiseFactory<Result4>, | ||
| pAll.PromiseFactory<Result5>, | ||
| pAll.PromiseFactory<Result6> | ||
| ], | ||
| options?: pAll.Options | ||
| ): Promise<[Result1, Result2, Result3, Result4, Result5, Result6]>; | ||
| <Result1, Result2, Result3, Result4, Result5>( | ||
| tasks: [ | ||
| pAll.PromiseFactory<Result1>, | ||
| pAll.PromiseFactory<Result2>, | ||
| pAll.PromiseFactory<Result3>, | ||
| pAll.PromiseFactory<Result4>, | ||
| pAll.PromiseFactory<Result5> | ||
| ], | ||
| options?: pAll.Options | ||
| ): Promise<[Result1, Result2, Result3, Result4, Result5]>; | ||
| <Result1, Result2, Result3, Result4>( | ||
| tasks: [ | ||
| pAll.PromiseFactory<Result1>, | ||
| pAll.PromiseFactory<Result2>, | ||
| pAll.PromiseFactory<Result3>, | ||
| pAll.PromiseFactory<Result4> | ||
| ], | ||
| options?: pAll.Options | ||
| ): Promise<[Result1, Result2, Result3, Result4]>; | ||
| <Result1, Result2, Result3>( | ||
| tasks: [ | ||
| pAll.PromiseFactory<Result1>, | ||
| pAll.PromiseFactory<Result2>, | ||
| pAll.PromiseFactory<Result3> | ||
| ], | ||
| options?: pAll.Options | ||
| ): Promise<[Result1, Result2, Result3]>; | ||
| <Result1, Result2>( | ||
| tasks: [pAll.PromiseFactory<Result1>, pAll.PromiseFactory<Result2>], | ||
| options?: pAll.Options | ||
| ): Promise<[Result1, Result2]>; | ||
| <Result1>( | ||
| tasks: [pAll.PromiseFactory<Result1>], | ||
| options?: pAll.Options | ||
| ): Promise<[Result1]>; | ||
| <TAll>( | ||
| tasks: Iterable<pAll.PromiseFactory<TAll>> | Array<pAll.PromiseFactory<TAll>>, | ||
| options?: pAll.Options | ||
| ): Promise<TAll[]>; | ||
| }; | ||
| export default function pAll<Task extends Array<PromiseFactory<unknown>>>( | ||
| tasks: readonly [...Task], | ||
| options?: Options, | ||
| ): Promise<{ | ||
| [P in keyof Task]: Task[P] extends () => unknown ? Awaited<ReturnType<Task[P]>> : Task[P] | ||
| }>; | ||
| export = pAll; | ||
| export {Options}; |
+4
-3
@@ -1,4 +0,5 @@ | ||
| 'use strict'; | ||
| const pMap = require('p-map'); | ||
| import pMap from 'p-map'; | ||
| module.exports = (iterable, options) => pMap(iterable, element => element(), options); | ||
| export default async function pAll(iterable, options) { | ||
| return pMap(iterable, element => element(), options); | ||
| } |
+9
-7
| { | ||
| "name": "p-all", | ||
| "version": "3.0.0", | ||
| "version": "4.0.0", | ||
| "description": "Run promise-returning & async functions concurrently with optional limited concurrency", | ||
@@ -13,4 +13,6 @@ "license": "MIT", | ||
| }, | ||
| "type": "module", | ||
| "exports": "./index.js", | ||
| "engines": { | ||
| "node": ">=10" | ||
| "node": ">=12.20" | ||
| }, | ||
@@ -48,10 +50,10 @@ "scripts": { | ||
| "dependencies": { | ||
| "p-map": "^4.0.0" | ||
| "p-map": "^5.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "ava": "^1.4.1", | ||
| "delay": "^4.1.0", | ||
| "tsd": "^0.11.0", | ||
| "xo": "^0.28.0" | ||
| "ava": "^3.15.0", | ||
| "delay": "^5.0.0", | ||
| "tsd": "^0.16.0", | ||
| "xo": "^0.40.1" | ||
| } | ||
| } |
+10
-12
@@ -1,2 +0,2 @@ | ||
| # p-all [](https://travis-ci.org/sindresorhus/p-all) | ||
| # p-all | ||
@@ -20,15 +20,13 @@ > Run promise-returning & async functions concurrently with optional limited concurrency | ||
| ```js | ||
| const pAll = require('p-all'); | ||
| const got = require('got'); | ||
| import pAll from 'p-all'; | ||
| import got from 'got'; | ||
| (async () => { | ||
| const actions = [ | ||
| () => got('https://sindresorhus.com'), | ||
| () => got('https://ava.li'), | ||
| () => checkSomething(), | ||
| () => doSomethingElse() | ||
| ]; | ||
| const actions = [ | ||
| () => got('https://sindresorhus.com'), | ||
| () => got('https://avajs.dev'), | ||
| () => checkSomething(), | ||
| () => doSomethingElse() | ||
| ]; | ||
| console.log(await pAll(actions, {concurrency: 2})); | ||
| })(); | ||
| console.log(await pAll(actions, {concurrency: 2})); | ||
| ``` | ||
@@ -35,0 +33,0 @@ |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Yes
NaN5567
-38.18%32
-82.42%72
-2.7%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
Updated