@xylabs/promise 4.2.1 → 4.3.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/neutral/fulfilled.d.ts +5 -0
- package/dist/neutral/fulfilled.d.ts.map +1 -1
- package/dist/neutral/fulfilledValues.d.ts +18 -0
- package/dist/neutral/fulfilledValues.d.ts.map +1 -1
- package/dist/neutral/rejected.d.ts +5 -0
- package/dist/neutral/rejected.d.ts.map +1 -1
- package/dist/neutral/types.d.ts +1 -0
- package/dist/neutral/types.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fulfilled.d.ts","sourceRoot":"","sources":["../../src/fulfilled.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fulfilled.d.ts","sourceRoot":"","sources":["../../src/fulfilled.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,KAAG,GAAG,IAAI,sBAAsB,CAAC,CAAC,CAE1F,CAAA"}
|
|
@@ -1,2 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* For use with Promise.allSettled to reduce to only successful result values
|
|
3
|
+
* @example <caption>Casting the initialValue provided to reduce</caption>
|
|
4
|
+
* const resolved = Promise.resolve('resolved')
|
|
5
|
+
* const rejected = Promise.reject('rejected')
|
|
6
|
+
* const settled = await Promise.allSettled([resolved, rejected])
|
|
7
|
+
* const results = settled.reduce(fulfilledValues, [] as string[])
|
|
8
|
+
* // results === [ 'resolved' ]
|
|
9
|
+
* @example <caption>Providing type parameter to reduce and initialValue type can be inferred</caption>
|
|
10
|
+
* const resolved = Promise.resolve('resolved')
|
|
11
|
+
* const rejected = Promise.reject('rejected')
|
|
12
|
+
* const settled = await Promise.allSettled([resolved, rejected])
|
|
13
|
+
* const results = settled.reduce<string[]>(fulfilledValues, [])
|
|
14
|
+
* // results === [ 'resolved' ]
|
|
15
|
+
* @param previousValue
|
|
16
|
+
* @param currentValue
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
1
19
|
export declare const fulfilledValues: <T>(previousValue: T[], currentValue: PromiseSettledResult<T>) => T[];
|
|
2
20
|
//# sourceMappingURL=fulfilledValues.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fulfilledValues.d.ts","sourceRoot":"","sources":["../../src/fulfilledValues.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fulfilledValues.d.ts","sourceRoot":"","sources":["../../src/fulfilledValues.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,iBAAiB,CAAC,EAAE,gBAAgB,oBAAoB,CAAC,CAAC,CAAC,KAAG,CAAC,EAG/F,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rejected.d.ts","sourceRoot":"","sources":["../../src/rejected.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rejected.d.ts","sourceRoot":"","sources":["../../src/rejected.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,KAAG,GAAG,IAAI,qBAEjE,CAAA"}
|
package/dist/neutral/types.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ export type OptionalPromisable<T, V = never> = Promisable<T | undefined, V>;
|
|
|
5
5
|
export type OptionalPromisableArray<T, V = never> = PromisableArray<T | undefined, V>;
|
|
6
6
|
export type NullablePromisable<T, V = never> = Promisable<T | null, V>;
|
|
7
7
|
export type NullablePromisableArray<T, V = never> = PromisableArray<T | null, V>;
|
|
8
|
+
/** @description Used to document promises that are being used as Mutexes */
|
|
8
9
|
export type AsyncMutex<T> = Promise<T>;
|
|
9
10
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AACvE,MAAM,MAAM,eAAe,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AAC9D,MAAM,MAAM,kBAAkB,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,UAAU,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,CAAC,CAAA;AAC3E,MAAM,MAAM,uBAAuB,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,eAAe,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,CAAC,CAAA;AACrF,MAAM,MAAM,kBAAkB,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,UAAU,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAA;AACtE,MAAM,MAAM,uBAAuB,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,eAAe,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AACvE,MAAM,MAAM,eAAe,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AAC9D,MAAM,MAAM,kBAAkB,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,UAAU,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,CAAC,CAAA;AAC3E,MAAM,MAAM,uBAAuB,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,eAAe,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,CAAC,CAAA;AACrF,MAAM,MAAM,kBAAkB,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,UAAU,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAA;AACtE,MAAM,MAAM,uBAAuB,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,eAAe,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAA;AAEhF,4EAA4E;AAC5E,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/promise",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"promise",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"module": "./dist/neutral/index.mjs",
|
|
37
37
|
"types": "./dist/neutral/index.d.ts",
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@xylabs/ts-scripts-yarn3": "^4.2.
|
|
40
|
-
"@xylabs/tsconfig": "^4.2.
|
|
39
|
+
"@xylabs/ts-scripts-yarn3": "^4.2.3",
|
|
40
|
+
"@xylabs/tsconfig": "^4.2.3",
|
|
41
41
|
"@xylabs/tsconfig-jest": "^4.1.0",
|
|
42
42
|
"typescript": "^5.6.3"
|
|
43
43
|
},
|