[**@bondsports/general**](../README.md) • **Docs**

***

[@bondsports/general](../globals.md) / useConditionalPromise

# Function: useConditionalPromise()

> **useConditionalPromise**\<`T`\>(`operation`, `condition`, `fallback`?): `Promise`\<`T`\>

Executes a promise-based operation conditionally based on a boolean condition.

## Type Parameters

• **T**

## Parameters

• **operation**

The promise-based operation to be executed.

• **condition**: `boolean`

The boolean condition that determines whether to execute the operation or use the fallback.

• **fallback?**

An optional fallback function to be executed if the condition is false. Its result will be returned as a promise.

## Returns

`Promise`\<`T`\>

A promise that resolves to the result of the operation or the fallback function.

## Defined in

[utils/general.util.ts:111](https://github.com/Bond-Sports/bondUtils/blob/545f16ceb055481acfd7641d7809c0f252d3a5e6/packages/general/src/utils/general.util.ts#L111)
