@naturalcycles/js-lib 14.78.1 → 14.79.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/decorators/logMethod.decorator.js +1 -1
- package/dist/decorators/memo.decorator.js +1 -1
- package/dist/decorators/memoFn.js +1 -1
- package/dist/error/try.js +0 -2
- package/dist/promise/pProps.d.ts +12 -3
- package/dist/promise/pProps.js +13 -17
- package/dist-esm/decorators/logMethod.decorator.js +1 -1
- package/dist-esm/decorators/memo.decorator.js +1 -1
- package/dist-esm/decorators/memoFn.js +1 -1
- package/dist-esm/error/try.js +0 -2
- package/dist-esm/promise/pProps.js +13 -17
- package/package.json +1 -1
- package/src/decorators/logMethod.decorator.ts +1 -1
- package/src/decorators/memo.decorator.ts +1 -1
- package/src/decorators/memoFn.ts +1 -1
- package/src/error/try.ts +0 -3
- package/src/promise/pProps.ts +16 -24
package/dist/error/try.js
CHANGED
package/dist/promise/pProps.d.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import { PMapOptions } from './pMap';
|
|
2
1
|
/**
|
|
3
2
|
* Promise.all for Object instead of Array.
|
|
4
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* Inspired by Bluebird Promise.props() and https://github.com/sindresorhus/p-props
|
|
5
|
+
*
|
|
6
|
+
* Improvements:
|
|
7
|
+
*
|
|
8
|
+
* - Exported as { pProps }, so IDE auto-completion works
|
|
9
|
+
* - Simpler: no support for Map, Mapper, Options
|
|
10
|
+
* - Included Typescript typings (no need for @types/p-props)
|
|
11
|
+
*
|
|
12
|
+
* Concurrency implementation via pMap was removed in favor of preserving async
|
|
13
|
+
* stack traces (more important!).
|
|
5
14
|
*/
|
|
6
15
|
export declare function pProps<T>(input: {
|
|
7
16
|
[K in keyof T]: T[K] | Promise<T[K]>;
|
|
8
|
-
}
|
|
17
|
+
}): Promise<{
|
|
9
18
|
[K in keyof T]: Awaited<T[K]>;
|
|
10
19
|
}>;
|
package/dist/promise/pProps.js
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Inspired by Bluebird Promise.props() and https://github.com/sindresorhus/p-props
|
|
4
|
-
|
|
5
|
-
Improvements:
|
|
6
|
-
|
|
7
|
-
- Exported as { pProps }, so IDE auto-completion works
|
|
8
|
-
- Simpler: no support for Map, Mapper, Options
|
|
9
|
-
- Included Typescript typings (no need for @types/p-props)
|
|
10
|
-
*/
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.pProps = void 0;
|
|
13
|
-
const pMap_1 = require("./pMap");
|
|
14
|
-
// todo: remove when eslint starts to know about Awaited
|
|
15
|
-
/* eslint-disable no-undef */
|
|
16
4
|
/**
|
|
17
5
|
* Promise.all for Object instead of Array.
|
|
18
|
-
*
|
|
6
|
+
*
|
|
7
|
+
* Inspired by Bluebird Promise.props() and https://github.com/sindresorhus/p-props
|
|
8
|
+
*
|
|
9
|
+
* Improvements:
|
|
10
|
+
*
|
|
11
|
+
* - Exported as { pProps }, so IDE auto-completion works
|
|
12
|
+
* - Simpler: no support for Map, Mapper, Options
|
|
13
|
+
* - Included Typescript typings (no need for @types/p-props)
|
|
14
|
+
*
|
|
15
|
+
* Concurrency implementation via pMap was removed in favor of preserving async
|
|
16
|
+
* stack traces (more important!).
|
|
19
17
|
*/
|
|
20
|
-
async function pProps(input
|
|
21
|
-
const r = {};
|
|
18
|
+
async function pProps(input) {
|
|
22
19
|
const keys = Object.keys(input);
|
|
23
|
-
|
|
24
|
-
return r;
|
|
20
|
+
return Object.fromEntries((await Promise.all(Object.values(input))).map((v, i) => [keys[i], v]));
|
|
25
21
|
}
|
|
26
22
|
exports.pProps = pProps;
|
package/dist-esm/error/try.js
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Inspired by Bluebird Promise.props() and https://github.com/sindresorhus/p-props
|
|
3
|
-
|
|
4
|
-
Improvements:
|
|
5
|
-
|
|
6
|
-
- Exported as { pProps }, so IDE auto-completion works
|
|
7
|
-
- Simpler: no support for Map, Mapper, Options
|
|
8
|
-
- Included Typescript typings (no need for @types/p-props)
|
|
9
|
-
*/
|
|
10
|
-
import { pMap } from './pMap';
|
|
11
|
-
// todo: remove when eslint starts to know about Awaited
|
|
12
|
-
/* eslint-disable no-undef */
|
|
13
1
|
/**
|
|
14
2
|
* Promise.all for Object instead of Array.
|
|
15
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* Inspired by Bluebird Promise.props() and https://github.com/sindresorhus/p-props
|
|
5
|
+
*
|
|
6
|
+
* Improvements:
|
|
7
|
+
*
|
|
8
|
+
* - Exported as { pProps }, so IDE auto-completion works
|
|
9
|
+
* - Simpler: no support for Map, Mapper, Options
|
|
10
|
+
* - Included Typescript typings (no need for @types/p-props)
|
|
11
|
+
*
|
|
12
|
+
* Concurrency implementation via pMap was removed in favor of preserving async
|
|
13
|
+
* stack traces (more important!).
|
|
16
14
|
*/
|
|
17
|
-
export async function pProps(input
|
|
18
|
-
const r = {};
|
|
15
|
+
export async function pProps(input) {
|
|
19
16
|
const keys = Object.keys(input);
|
|
20
|
-
await
|
|
21
|
-
return r;
|
|
17
|
+
return Object.fromEntries((await Promise.all(Object.values(input))).map((v, i) => [keys[i], v]));
|
|
22
18
|
}
|
package/package.json
CHANGED
|
@@ -110,7 +110,7 @@ export function _LogMethod(opt: LogMethodOptions = {}): MethodDecorator {
|
|
|
110
110
|
})
|
|
111
111
|
.catch((err: any) => {
|
|
112
112
|
logFinished(logger, callSignature, started, sma, logResultFn, undefined, err)
|
|
113
|
-
|
|
113
|
+
throw err
|
|
114
114
|
})
|
|
115
115
|
} else {
|
|
116
116
|
// not a Promise
|
package/src/decorators/memoFn.ts
CHANGED
package/src/error/try.ts
CHANGED
package/src/promise/pProps.ts
CHANGED
|
@@ -1,28 +1,20 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Inspired by Bluebird Promise.props() and https://github.com/sindresorhus/p-props
|
|
3
|
-
|
|
4
|
-
Improvements:
|
|
5
|
-
|
|
6
|
-
- Exported as { pProps }, so IDE auto-completion works
|
|
7
|
-
- Simpler: no support for Map, Mapper, Options
|
|
8
|
-
- Included Typescript typings (no need for @types/p-props)
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { pMap, PMapOptions } from './pMap'
|
|
12
|
-
|
|
13
|
-
// todo: remove when eslint starts to know about Awaited
|
|
14
|
-
/* eslint-disable no-undef */
|
|
15
|
-
|
|
16
1
|
/**
|
|
17
2
|
* Promise.all for Object instead of Array.
|
|
18
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* Inspired by Bluebird Promise.props() and https://github.com/sindresorhus/p-props
|
|
5
|
+
*
|
|
6
|
+
* Improvements:
|
|
7
|
+
*
|
|
8
|
+
* - Exported as { pProps }, so IDE auto-completion works
|
|
9
|
+
* - Simpler: no support for Map, Mapper, Options
|
|
10
|
+
* - Included Typescript typings (no need for @types/p-props)
|
|
11
|
+
*
|
|
12
|
+
* Concurrency implementation via pMap was removed in favor of preserving async
|
|
13
|
+
* stack traces (more important!).
|
|
19
14
|
*/
|
|
20
|
-
export async function pProps<T>(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const keys = Object.keys(input) as (keyof T)[]
|
|
26
|
-
await pMap(Object.values(input), (v, i) => (r[keys[i]!] = v), opt)
|
|
27
|
-
return r
|
|
15
|
+
export async function pProps<T>(input: { [K in keyof T]: T[K] | Promise<T[K]> }): Promise<{
|
|
16
|
+
[K in keyof T]: Awaited<T[K]>
|
|
17
|
+
}> {
|
|
18
|
+
const keys = Object.keys(input)
|
|
19
|
+
return Object.fromEntries((await Promise.all(Object.values(input))).map((v, i) => [keys[i], v]))
|
|
28
20
|
}
|