Skip to content

Commit 58a4bf8

Browse files
committed
Require Node.js 10
1 parent 4362c38 commit 58a4bf8

7 files changed

+18
-23
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: node_js
22
node_js:
3+
- '14'
34
- '12'
45
- '10'
5-
- '8'

index.d.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ declare function pProps<
5252
ValueType,
5353
MappedValueType = pProps.PromiseResult<ValueType>
5454
>(
55-
map: Map<KeyType, ValueType>,
55+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
56+
map: ReadonlyMap<KeyType, ValueType>,
5657
mapper?: pProps.Mapper<pProps.PromiseResult<ValueType>, KeyType, MappedValueType>,
5758
options?: pProps.Options
5859
): Promise<Map<KeyType, MappedValueType>>;

index.js

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const object = async (map, mapper, options) => {
2525
return result;
2626
};
2727

28+
// eslint-disable-next-line default-param-last
2829
const pProps = (input, mapper = (value => value), options) => {
2930
return input instanceof Map ?
3031
map(input, mapper, options) :

index.test-d.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import {expectType} from 'tsd';
1+
import {expectType, expectAssignable} from 'tsd';
22
import pProps = require('.');
33

4+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
45
const options: pProps.Options = {};
56

67
expectType<Promise<{[key in 'foo']: string}>>(pProps({foo: 'bar'}));
@@ -36,7 +37,7 @@ expectType<Promise<{[key in 'unicorn' | 'foo']: string | number}>>(
3637
expectType<Promise<{[key in 'unicorn' | 'foo']: boolean}>>(
3738
pProps(hashMap, (value, key) => {
3839
expectType<string | number>(value);
39-
expectType<string>(key);
40+
expectAssignable<string>(key);
4041
return Math.random() > 0.5 ? false : Promise.resolve(true);
4142
})
4243
);
@@ -45,7 +46,7 @@ expectType<Promise<{[key in 'unicorn' | 'foo']: boolean}>>(
4546
hashMap,
4647
(value, key) => {
4748
expectType<string | number>(value);
48-
expectType<string>(key);
49+
expectAssignable<string>(key);
4950
return Math.random() > 0.5 ? false : Promise.resolve(true);
5051
},
5152
{
@@ -70,7 +71,7 @@ pProps(map).then(result => {
7071
expectType<Promise<Map<number, string>>>(pProps(map));
7172
expectType<Promise<Map<number, number>>>(
7273
pProps(map, (value, key) => {
73-
expectType<string | Promise<string>>(value);
74+
expectType<string>(value);
7475
expectType<number>(key);
7576
return Math.random() > 0.5 ? 1 : Promise.resolve(2);
7677
})
@@ -79,7 +80,7 @@ expectType<Promise<Map<number, number>>>(
7980
pProps(
8081
map,
8182
(value, key) => {
82-
expectType<string | Promise<string>>(value);
83+
expectType<string>(value);
8384
expectType<number>(key);
8485
return Math.random() > 0.5 ? 1 : Promise.resolve(2);
8586
},

license

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
3+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
"description": "Like `Promise.all()` but for `Map` and `Object`",
55
"license": "MIT",
66
"repository": "sindresorhus/p-props",
7+
"funding": "https://github.com/sponsors/sindresorhus",
78
"author": {
89
"name": "Sindre Sorhus",
910
"email": "sindresorhus@gmail.com",
10-
"url": "sindresorhus.com"
11+
"url": "https://sindresorhus.com"
1112
},
1213
"engines": {
13-
"node": ">=8"
14+
"node": ">=10"
1415
},
1516
"scripts": {
1617
"test": "xo && ava && tsd"
@@ -41,7 +42,7 @@
4142
"devDependencies": {
4243
"ava": "^2.0.0",
4344
"delay": "^4.2.0",
44-
"tsd": "^0.7.2",
45-
"xo": "^0.24.0"
45+
"tsd": "^0.11.0",
46+
"xo": "^0.30.0"
4647
}
4748
}

readme.md

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
# p-props [![Build Status](https://travis-ci.org/sindresorhus/p-props.svg?branch=master)](https://travis-ci.org/sindresorhus/p-props)
1+
# p-props [![Build Status](https://travis-ci.com/sindresorhus/p-props.svg?branch=master)](https://travis-ci.com/sindresorhus/p-props)
22

33
> Like [`Promise.all()`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise/all) but for `Map` and `Object`
44
55
Useful when you need to run multiple promises concurrently and keep track of the fulfilled values by name.
66

7-
87
## Install
98

109
```
1110
$ npm install p-props
1211
```
1312

14-
1513
## Usage
1614

1715
```js
@@ -43,10 +41,9 @@ const got = require('got');
4341
})();
4442
```
4543

46-
4744
## API
4845

49-
### pProps(map, [mapper], [options])
46+
### pProps(map, mapper?, options?)
5047

5148
Returns a `Promise` that is fulfilled when all promises in `map` and ones returned from `mapper` are fulfilled, or rejects if any of the promises reject. The fulfilled value is the same as `map`, but with a fulfilled version of each entry value, or the fulfilled value returned from `mapper`, if defined.
5249

@@ -68,14 +65,8 @@ Type: `object`
6865

6966
See the [`p-map` options](https://github.com/sindresorhus/p-map#options).
7067

71-
7268
## Related
7369

7470
- [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency
7571
- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently
7672
- [More…](https://github.com/sindresorhus/promise-fun)
77-
78-
79-
## License
80-
81-
MIT © [Sindre Sorhus](https://sindresorhus.com)

0 commit comments

Comments
 (0)