@xylabs/promise
Advanced tools
Comparing version 4.2.2 to 4.3.0
@@ -0,2 +1,7 @@ | ||
/** | ||
* For use with Promise.allSettled to filter only successful results | ||
* @param val | ||
* @returns | ||
*/ | ||
export declare const fulfilled: <T>(val: PromiseSettledResult<T>) => val is PromiseFulfilledResult<T>; | ||
//# sourceMappingURL=fulfilled.d.ts.map |
@@ -0,2 +1,20 @@ | ||
/** | ||
* For use with Promise.allSettled to reduce to only successful result values | ||
* @example <caption>Casting the initialValue provided to reduce</caption> | ||
* const resolved = Promise.resolve('resolved') | ||
* const rejected = Promise.reject('rejected') | ||
* const settled = await Promise.allSettled([resolved, rejected]) | ||
* const results = settled.reduce(fulfilledValues, [] as string[]) | ||
* // results === [ 'resolved' ] | ||
* @example <caption>Providing type parameter to reduce and initialValue type can be inferred</caption> | ||
* const resolved = Promise.resolve('resolved') | ||
* const rejected = Promise.reject('rejected') | ||
* const settled = await Promise.allSettled([resolved, rejected]) | ||
* const results = settled.reduce<string[]>(fulfilledValues, []) | ||
* // results === [ 'resolved' ] | ||
* @param previousValue | ||
* @param currentValue | ||
* @returns | ||
*/ | ||
export declare const fulfilledValues: <T>(previousValue: T[], currentValue: PromiseSettledResult<T>) => T[]; | ||
//# sourceMappingURL=fulfilledValues.d.ts.map |
@@ -0,2 +1,7 @@ | ||
/** | ||
* For use with Promise.allSettled to filter only rejected results | ||
* @param val | ||
* @returns | ||
*/ | ||
export declare const rejected: <T>(val: PromiseSettledResult<T>) => val is PromiseRejectedResult; | ||
//# sourceMappingURL=rejected.d.ts.map |
@@ -8,3 +8,4 @@ import type { PromiseEx } from './PromiseEx.ts'; | ||
export type NullablePromisableArray<T, V = never> = PromisableArray<T | null, V>; | ||
/** @description Used to document promises that are being used as Mutexes */ | ||
export type AsyncMutex<T> = Promise<T>; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@xylabs/promise", | ||
"version": "4.2.2", | ||
"version": "4.3.0", | ||
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries", | ||
@@ -39,4 +39,4 @@ "keywords": [ | ||
"devDependencies": { | ||
"@xylabs/ts-scripts-yarn3": "^4.2.1", | ||
"@xylabs/tsconfig": "^4.2.1", | ||
"@xylabs/ts-scripts-yarn3": "^4.2.3", | ||
"@xylabs/tsconfig": "^4.2.3", | ||
"@xylabs/tsconfig-jest": "^4.1.0", | ||
@@ -43,0 +43,0 @@ "typescript": "^5.6.3" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36820
384