@xylabs/promise
Advanced tools
Comparing version 2.10.0 to 2.10.1
@@ -1,3 +0,35 @@ | ||
export { fulfilled } from './fulfilled.js'; | ||
export { fulfilledValues } from './fulfilledValues.js'; | ||
export { rejected } from './rejected.js'; | ||
/** | ||
* For use with Promise.allSettled to filter only successful results | ||
* @param val | ||
* @returns | ||
*/ | ||
declare const fulfilled: <T>(val: PromiseSettledResult<T>) => val is PromiseFulfilledResult<T>; | ||
/** | ||
* 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 | ||
*/ | ||
declare const fulfilledValues: <T>(previousValue: T[], currentValue: PromiseSettledResult<T>) => T[]; | ||
/** | ||
* For use with Promise.allSettled to filter only rejected results | ||
* @param val | ||
* @returns | ||
*/ | ||
declare const rejected: <T>(val: PromiseSettledResult<T>) => val is PromiseRejectedResult; | ||
export { fulfilled, fulfilledValues, rejected }; |
@@ -68,3 +68,3 @@ { | ||
"sideEffects": false, | ||
"version": "2.10.0" | ||
"version": "2.10.1" | ||
} |
@@ -8,8 +8,10 @@ import { defineConfig } from 'tsup' | ||
clean: true, | ||
dts: true, | ||
entry: ['src'], | ||
dts: { | ||
entry: ['src/index.ts'], | ||
}, | ||
entry: ['src/index.ts'], | ||
format: ['cjs', 'esm'], | ||
sourcemap: true, | ||
splitting: false, | ||
tsconfig: 'tsconfig.json', | ||
tsconfig: 'tsconfig.build.json', | ||
}) |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
22448
14
154