mirror of
https://github.com/ow-mods/ow-mod-db.git
synced 2025-12-11 20:15:24 +01:00
18 lines
458 B
TypeScript
18 lines
458 B
TypeScript
export const getSettledResult = <TResult>(
|
|
results: PromiseSettledResult<TResult>
|
|
): TResult | undefined => {
|
|
if (results.status == "rejected") return undefined;
|
|
|
|
return results.value;
|
|
};
|
|
|
|
export function filterFulfilledPromiseSettleResults<T>(
|
|
result: PromiseSettledResult<T | null | undefined>
|
|
): result is PromiseFulfilledResult<T> {
|
|
return (
|
|
result.status === "fulfilled" &&
|
|
result.value != null &&
|
|
result.value != undefined
|
|
);
|
|
}
|