Skip to content

Commit 32faa8e

Browse files
committed
Require Node.js 16 and update p-map
Closes #12
1 parent 19d71e8 commit 32faa8e

File tree

6 files changed

+17
-19
lines changed

6 files changed

+17
-19
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
node-version:
13+
- 20
1314
- 18
1415
- 16
1516
steps:

index.d.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
import {Options} from 'p-map';
1+
import {type Options} from 'p-map';
22

33
type PromiseFactory<T> = () => PromiseLike<T>;
44

5-
// From: https://github.com/microsoft/TypeScript/blob/4f5b3299fee9a54b692aba9df7a9e894bd86e81d/src/lib/es2015.promise.d.ts#L1
6-
type Awaited<T> = T extends undefined ? T : T extends PromiseLike<infer U> ? U : T;
7-
85
/**
96
Run promise-returning & async functions concurrently with optional limited concurrency.
107
@@ -33,4 +30,4 @@ export default function pAll<Task extends Array<PromiseFactory<unknown>>>(
3330
[P in keyof Task]: Task[P] extends () => unknown ? Awaited<ReturnType<Task[P]>> : Task[P]
3431
}>;
3532

36-
export {Options};
33+
export {type Options} from 'p-map';

index.test-d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ const actions: [
55
() => Promise<string>,
66
() => Promise<string>,
77
() => Promise<void>,
8-
() => Promise<number>
8+
() => Promise<number>,
99
] = [
10-
async () => Promise.resolve('https://sindresorhus.com'),
11-
async () => Promise.resolve('https://avajs.dev'),
12-
async () => Promise.resolve(),
13-
async () => Promise.resolve(1)
10+
async () => 'https://sindresorhus.com',
11+
async () => 'https://avajs.dev',
12+
async () => {}, // eslint-disable-line @typescript-eslint/no-empty-function
13+
async () => 1,
1414
];
1515

1616
const result = await pAll(actions, {concurrency: 2});

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"type": "module",
1414
"exports": "./index.js",
1515
"engines": {
16-
"node": ">=12.20"
16+
"node": ">=16"
1717
},
1818
"scripts": {
1919
"test": "xo && ava && tsd"
@@ -46,12 +46,12 @@
4646
"bluebird"
4747
],
4848
"dependencies": {
49-
"p-map": "^5.0.0"
49+
"p-map": "^6.0.0"
5050
},
5151
"devDependencies": {
52-
"ava": "^3.15.0",
52+
"ava": "^5.2.0",
5353
"delay": "^5.0.0",
54-
"tsd": "^0.16.0",
55-
"xo": "^0.40.1"
54+
"tsd": "^0.28.1",
55+
"xo": "^0.54.1"
5656
}
5757
}

readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ See [`p-series`](https://github.com/sindresorhus/p-series) for a serial counterp
1010

1111
## Install
1212

13-
```
14-
$ npm install p-all
13+
```sh
14+
npm install p-all
1515
```
1616

1717
## Usage
@@ -59,7 +59,7 @@ Number of concurrent pending promises.
5959
Type: `boolean`\
6060
Default: `true`
6161

62-
When set to `false`, instead of stopping when a promise rejects, it will wait for all the promises to settle and then reject with an [aggregated error](https://github.com/sindresorhus/aggregate-error) containing all the errors from the rejected promises.
62+
When set to `false`, instead of stopping when a promise rejects, it will wait for all the promises to settle and then reject with an [`AggregateError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AggregateError) containing all the errors from the rejected promises.
6363

6464
## Related
6565

test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test('main', async t => {
1111
return 2;
1212
},
1313
() => 3,
14-
async () => 4
14+
async () => 4,
1515
];
1616

1717
t.deepEqual(await pAll(input), [1, 2, 3, 4]);

0 commit comments

Comments
 (0)