UNPKG
equation-sdk
Version:
latest (1.0.7)
1.0.7
1.0.6
1.0.5
1.0.3
1.0.1
1.0.0
🛠An SDK for building applications on top of Equation.
equation-sdk
/
src
/
utils
/
catchFn.ts
9 lines
(8 loc)
•
167 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
export function catchFn<T, U>(
func
:
()
=> T, defaultValue: U): T | U { try {
const
result =
func
()
;
return
result; } catch (
error
) {
return
defaultValue; } }